GetCancelReason: Difference between revisions
Jump to navigation
Jump to search
m (→See Also) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 18: | Line 18: | ||
<syntaxhighlight lang="lua">-- call 'stopVehicleEntry' whenever hunterPlayer is about to enter a vehicle: | <syntaxhighlight lang="lua">-- call 'stopVehicleEntry' whenever hunterPlayer is about to enter a vehicle: | ||
function stopVehicleEntry ( theplayer, seat, jacked ) | function stopVehicleEntry ( theplayer, seat, jacked ) | ||
cancelEvent ("You can't enter a vehicle during war.") -- stop the event from occuring and tell the player the reason. | 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 | outputConsole("We told "..getPlayerName(theplayer).." : "..getCancelReason()) --Now tell everyone what the player tried to do | ||
end | end | ||
Line 25: | Line 25: | ||
==See Also== | ==See Also== | ||
{{Event functions}} | {{Event functions|server}} | ||
Latest revision as of 22:33, 6 September 2024
Gets the reason for cancelling an event.
Syntax
string getCancelReason ( )
Required Arguments
None
Returns
Returns the reason that was given with cancelEvent
Example
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 )
See Also
- getCancelReason
- triggerClientEvent
- triggerLatentClientEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled