SetTrainTrack: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Little mistake)
m (fix oop)
Line 7: Line 7:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setTrainTrack ( vehicle train, int track )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setTrainTrack ( vehicle train, int track )</syntaxhighlight>
{{OOP||[[vehicle]]:setTrack|track|setTrainTrack}}
{{OOP||[[vehicle]]:setTrack|track|getTrainTrack}}
===Required Arguments===
===Required Arguments===
*'''train:''' the train of which to set the track
*'''train:''' the train of which to set the track

Revision as of 00:44, 13 September 2015

Sets the track of a train

Syntax

bool setTrainTrack ( vehicle train, int track )

OOP Syntax Help! I don't understand this!

Method: vehicle:setTrack(...)
Variable: .track
Counterpart: getTrainTrack


Required Arguments

  • train: the train of which to set the track
  • track: the track where you want to set the train. It can be 1, 2 or 3.

Returns

Returns true if the track was set to the train, false otherwise.

Example

addCommandHandler("setTrain",
function (cmd,train)
	local thePlayer = getLocalPlayer()
	local theVehicle = getPedOccupiedVehicle(thePlayer)
	local cc = getElementModel(theVehicle)
		if cc == 449 or cc == 537 or cc == 538 or cc == 570 or cc == 569 or cc == 590 then
	setTrainTrack(theVehicle, train)
		end
end)

See Also

Shared