GetTrainTrack: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Undo revision 61853 by StrixG (talk))
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Shared function}}
{{Shared function}}
Gets the track of a train.
{{New feature/item|3.0160|1.6|7485|
Gets the track of a train
}}


==Syntax==
==Syntax==

Revision as of 00:32, 7 January 2019

Gets the track of a train

Syntax

int getTrainTrack ( vehicle train )

OOP Syntax Help! I don't understand this!

Method: vehicle:getTrack(...)
Variable: .track
Counterpart: setTrainTrack


Required Arguments

  • train: the train of which to get the track.

Returns

Returns an integer (whole number) that represents the train track, false if there is problem with train element.

Example

addCommandHandler("traintrack",
function (player)
   if isPedInVehicle (player) then
      local theVehicle = getPedOccupiedVehicle(player)
      if getVehicleType(theVehicle) == "Train" then
	  local track = getTrainTrack(theVehicle)
	  outputChatBox("Train Track is "..track,player,0,255,0)
      end
   end
end
)

See Also