setTrainDerailable | Multi Theft Auto: Wiki Skip to content

setTrainDerailable

Client-side
Server-side
Shared

Pair: isTrainDerailable

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function will set a train or tram as derailable. This is, if it can derail when it goes above the maximum speed.

Syntax

setTrainDerailable ( )

Code Examples

server

This example will allow players to toggle derailability of the train they are driving

function derailToggle()
local vehicle = getPedOccupiedVehicle(localPlayer)
if not vehicle then return end
if getVehicleType(vehicle) == "Train" and getVehicleController(vehicle) == localPlayer then
setTrainDerailable(vehicle, not isTrainDerailable(vehicle))
outputChatBox("Derailing for this train has been toggled!")
end
end
addCommandHandler("togglederail", derailToggle)

See Also

Vehicle Functions