SetTrainDirection: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server client function}} Sets the direction in which a train or tram drives over the rails (clockwise or counterclockwise). ==Syntax== <syntaxhighlight lang="lua">bool setTrainDirection ( veh...) |
No edit summary |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setTrainDirection ( vehicle train, bool clockwise ) | <syntaxhighlight lang="lua">bool setTrainDirection ( vehicle train, bool clockwise )</syntaxhighlight> | ||
{{OOP||[[vehicle]]:setDirection|direction|getTrainDirection}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''train:''' the train whose direction to change. | *'''train:''' the train whose direction to change. | ||
Line 13: | Line 13: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if successful, ''false'' otherwise. | Returns ''true'' if successful, ''false'' otherwise. | ||
==Example== | |||
This function will make a train driving clockwise. | |||
<syntaxhighlight lang="lua"> | |||
function createTrain(source) | |||
local myTrain = createVehicle(537,1995,-1949,13) -- Create the train | |||
setTrainDirection(myTrain, true) -- Make the train drive clockwise | |||
setTrainSpeed(myTrain, 1) -- Speed up | |||
end | |||
addCommandHandler("mytrain", createTrain) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Latest revision as of 22:26, 18 December 2014
Sets the direction in which a train or tram drives over the rails (clockwise or counterclockwise).
Syntax
bool setTrainDirection ( vehicle train, bool clockwise )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setDirection(...)
- Variable: .direction
- Counterpart: getTrainDirection
Required Arguments
- train: the train whose direction to change.
- clockwise: if true, will make the train go clockwise. If false, makes it go counterclockwise.
Returns
Returns true if successful, false otherwise.
Example
This function will make a train driving clockwise.
function createTrain(source) local myTrain = createVehicle(537,1995,-1949,13) -- Create the train setTrainDirection(myTrain, true) -- Make the train drive clockwise setTrainSpeed(myTrain, 1) -- Speed up end addCommandHandler("mytrain", createTrain)
See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates