Difference between revisions of "IsTrainDerailed"

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(isTrainDerailed)
Line 25: Line 25:
     end
     end
end
end
addCommandHandler("checkTrain", checkDerailed) --adds the command handler
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 13:49, 12 October 2011

This function will check if a train or tram is derailed.

Syntax

bool isTrainDerailed ( vehicle vehicleToCheck )              

Required Arguments

  • vehicleToCheck: The vehicle that you wish to check is derailed.

Returns

Returns true if the train is derailed, false if the train is still on the rails

Example

Click to collapse [-]
Example
function checkDerailed(player)
    if isPedInVehicle(player) and getVehicleType(getPedOccupiedVehicle(player) then --is the player in a vehicle and is it a train?
        if isTrainDerailed(getPedOccupiedVehicle(player)) then --is the train derailed?
            outputChatBox("Your train is derailed", player) --outputs a message
        end
    end
end
addCommandHandler("checkTrain", checkDerailed) --adds the command handler

See Also