getCancelReason
Client-side
Server-side
Shared
Gets the reason for cancelling an event.
Syntax
string getCancelReason ( )Returns
- string: result
Returns the reason that was given with cancelEvent.
Code Examples
server
This example cancels when a hunterPlayer tries 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 doendaddEventHandler("onVehicleStartEnter", huntedPlayer, stopVehicleEntry)