getCancelReason | Multi Theft Auto: Wiki Skip to content

getCancelReason

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.


Gets the reason for cancelling an event.

Syntax

getCancelReason ( )

Code Examples

server

This example cancels when a hunterPlayer tries to enter a vehicle and outputs to the world what the player tried to do.

-- call 'stopVehicleEntry' whenever hunterPlayer is about to enter a vehicle:
function stopVehicleEntry ( theplayer, seat, jacked )
cancelEvent (true, "You can't enter a vehicle during war.") -- stop the event from occuring and tell the player the reason.
outputConsole("We told "..getPlayerName(theplayer).." : "..getCancelReason()) --Now tell everyone what the player tried to do
end
addEventHandler ( "onVehicleStartEnter", huntedPlayer, stopVehicleEntry )