SetTrainTrack: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (missing player element in outputchatbox)
Line 39: Line 39:
local veh = player.vehicle
local veh = player.vehicle
if not veh then
if not veh then
return outputChatBox("You are not in a vehicle!", player)
return player:outputChat("You are not in a vehicle!")
end
end


Line 45: Line 45:
veh.track = track
veh.track = track
else
else
outputChatBox("You are not in a train!", player)
player:outputChat("You are not in a train!")
end
end
end
end

Revision as of 17:02, 7 July 2018

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 0, 1, 2 or 3.

Returns

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

Example

This server-side script allows the player to change the track of their train.

Click to expand [+]
Procedural
Click to expand [+]
Object Oriented

See Also