SetTrainDerailed: Difference between revisions
Jump to navigation
Jump to search
Cazomino05 (talk | contribs) No edit summary |
No edit summary |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
This function will set a train or tram as derailed. | This function will set a train or tram as derailed. | ||
Line 8: | Line 7: | ||
bool setTrainDerailed ( vehicle vehicleToDerail, bool derailed ) | bool setTrainDerailed ( vehicle vehicleToDerail, bool derailed ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:setDerailed|derailed|isTrainDerailed}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''vehicleToDerail:''' The vehicle that you wish to derail. | *'''vehicleToDerail:''' The vehicle that you wish to derail. | ||
Line 15: | Line 14: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the state was successfully set | Returns ''true'' if the state was successfully set | ||
==Example== | |||
<section name="Example" class="server" show="true"> | |||
This example creates an underailable train, and allows it to be derailed when you want | |||
<syntaxhighlight lang="lua"> | |||
function makeTrain(thePlayer) | |||
myTrain = createVehicle(537,1995,-1949,13)-- This will make a freight train just east of the LS train station | |||
setTrainDerailable(myTrain, false) -- myTrain can not be derailed now | |||
outputChatBox("A freight train has been created for you.", thePlayer) -- Just a simple message for the player | |||
end | |||
addCommandHandler("trainmeup", makeTrain) | |||
function derailTrain() | |||
setTrainDerailed(myTrain, true) -- When the command is used the train becomes derailed | |||
outputChatBox("Freight train has been derailed!", thePlayer) -- A message to confirm the train was derailed | |||
end | |||
addCommandHandler("derailme", derailTrain) | |||
</syntaxhighlight> | |||
</section> | |||
==See Also== | ==See Also== | ||
{{Vehicle_functions}} | {{Vehicle_functions}} |
Latest revision as of 22:29, 18 December 2014
This function will set a train or tram as derailed.
Syntax
bool setTrainDerailed ( vehicle vehicleToDerail, bool derailed )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setDerailed(...)
- Variable: .derailed
- Counterpart: isTrainDerailed
Required Arguments
- vehicleToDerail: The vehicle that you wish to derail.
- derailed: whether the train is derailed.
Returns
Returns true if the state was successfully set
Example
Click to collapse [-]
ExampleThis example creates an underailable train, and allows it to be derailed when you want
function makeTrain(thePlayer) myTrain = createVehicle(537,1995,-1949,13)-- This will make a freight train just east of the LS train station setTrainDerailable(myTrain, false) -- myTrain can not be derailed now outputChatBox("A freight train has been created for you.", thePlayer) -- Just a simple message for the player end addCommandHandler("trainmeup", makeTrain) function derailTrain() setTrainDerailed(myTrain, true) -- When the command is used the train becomes derailed outputChatBox("Freight train has been derailed!", thePlayer) -- A message to confirm the train was derailed end addCommandHandler("derailme", derailTrain)
See 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