Difference between revisions of "SetTrainDirection"

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 28: Line 28:
==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}
[[Category:Needs Example]]

Revision as of 19:02, 28 February 2012

Sets the direction in which a train or tram drives over the rails (clockwise or counterclockwise).


bool setTrainDirection ( vehicle train, bool clockwise )

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 true if successful, false otherwise.


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
addCommandHandler("mytrain", createTrain)

See Also