SetTrainTrack: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (delete -> disabled) |
||
(11 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Shared function}} | ||
{{New feature/item|3. | {{Disabled}} | ||
{{New feature/item|3.0160|1.6|7485| | |||
Sets the track of a train | Sets the track of a train | ||
}} | }} | ||
Line 7: | Line 8: | ||
==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| | {{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 | ||
*'''track:''' the track where you want to set the train. It can be 1, 2 or 3. | *'''track:''' the track where you want to set the train. It can be 0, 1, 2 or 3. | ||
===Returns=== | ===Returns=== | ||
Line 16: | Line 17: | ||
==Example== | ==Example== | ||
This server-side script allows the player to change the track of their train. | |||
<section name="Procedural" class="server"><syntaxhighlight lang="lua"> | |||
addCommandHandler("trackies", | |||
function (player, _, track) | |||
local theVehicle = getPedOccupiedVehicle(player) | |||
if not theVehicle then | |||
outputChatBox("You are not in a vehicle!", player) | |||
return | |||
end | |||
if getVehicleType(theVehicle) == "Train" then | |||
setTrainTrack(theVehicle, track) | |||
else | |||
outputChatBox("You are not in a train!", player) | |||
end | |||
end | |||
) | |||
</syntaxhighlight></section> | |||
<section name="Object Oriented" class="server"><syntaxhighlight lang="lua"> | |||
addCommandHandler("trackies", | |||
function (player, _, track) | |||
local veh = player.vehicle | |||
if not veh then | |||
return player:outputChat("You are not in a vehicle!") | |||
end | |||
if veh.vehicleType == "Train" then | |||
veh.track = track | |||
else | |||
player:outputChat("You are not in a train!") | |||
end | end | ||
end) | end | ||
</syntaxhighlight> | ) | ||
</syntaxhighlight></section> | |||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Latest revision as of 19:38, 19 May 2019
Function has been disabled. | |
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 [+]
ProceduralClick to expand [+]
Object OrientedSee Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates