GetTrainTrack: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (replace delete with disabled)
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Shared function}}
{{Needs Example}}
{{Disabled}}
{{New feature/item|3.0151|1.6|7485|
{{New feature/item|3.0160|1.6|7485|
Gets the track of a train
Gets the track of a train
}}
}}
Line 8: Line 8:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">int getTrainTrack ( vehicle train )</syntaxhighlight>
<syntaxhighlight lang="lua">int getTrainTrack ( vehicle train )</syntaxhighlight>
{{OOP||[[vehicle]]:getTrack|track|getTrainTrack}}
{{OOP||[[vehicle]]:getTrack|track|setTrainTrack}}
===Required Arguments===
===Required Arguments===
*'''train:''' the train of which to get the track.
*'''train:''' the train of which to get the track.


===Returns===
===Returns===
Returns an ''intenger'' which means the track of the train, ''false'' if there is problem with train element.
Returns an integer (whole number) that represents the train track, ''false'' if there is problem with train element.


==Example==
==Example==


<syntaxhighlight lang="lua">--TODO
<syntaxhighlight lang="lua">
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
)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}

Latest revision as of 19:36, 19 May 2019

Dialog-warning.png Function has been disabled.

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