isTrainDerailable | Multi Theft Auto: Wiki Skip to content

isTrainDerailable

Client-side
Server-side
Shared

Pair: setTrainDerailable

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 check if a train or tram is derailable.

Syntax

isTrainDerailable ( )

Code Examples

server
local function playerVehicleEnter()
local localVehicle = getPedOccupiedVehicle(localPlayer)
if not isElement(localVehicle) then return end -- In case getPedOccupiedVehicle() does not return a valid vehicle, for whatever reason
if getVehicleType(localVehicle) == "Train" then
if isTrainDerailable(localVehicle) then
outputChatBox("* Warning: this train could derail!", 255, 0, 0)
end
end
end
addEventHandler("onClientPlayerVehicleEnter", localPlayer, playerVehicleEnter)

See Also

Vehicle Functions