isTrainChainEngine | Multi Theft Auto: Wiki Skip to content

isTrainChainEngine

Client-side
Server-side
Shared

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 checks if a train is a chain engine (moves the rest of the chain's carriages) or not.

Syntax

isTrainChainEngine ( )

Code Examples

client

The next code snippet adds a /isthistrainachainengine, which checks if the train occupied by the player who types the command is a chain engine or not.

function checkTrainChainEngine()
if isPedInVehicle(localPlayer) then
local train = getPedOccupiedVehicle(localPlayer)
if getVehicleType(train) == "Train" then
outputChatBox("Your train " .. (isTrainChainEngine(train) and "is" or "isn't") .. " a chain engine.", 255, 128, 0)
else
outputChatBox("You need to be in a train to use this command.", 255, 0, 0)
end
end
end
addCommandHandler("isthistrainachainengine", checkTrainChainEngine)

See Also

Vehicle Functions