cancelEvent
Client-side
Server-side
Shared
This function is used to stop the automatic internal handling of events event.
Note
Not every event can be cancelled, so make sure the event is cancellable according to the documentation.
Client Syntax
bool cancelEvent ( )Returns
- bool: result
Always returns true.
Server Syntax
bool cancelEvent ( [ bool cancel = true, string reason = "" ] )Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- cancel (default: true): True to cancel, false to uncancel.
- reason (default: ""): The reason for cancelling the event.
Returns
- bool: result
Always returns true.
Code Examples
client
This example prevents any damage to a player clientside by making cancelEvent an event handler for the onClientPlayerDamage event.
function onClientPlayerDamage() cancelEvent()endaddEventHandler("onClientPlayerDamage", root, onClientPlayerDamage)