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
Always returns true.
- bool: result
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
Always returns true.
- bool: result
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)