cancelEvent
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function is used to stop the automatic internal handling of events, for example this can be used to prevent an item being given to a player when they walk over a pickup, by canceling the onPickupUse event.
Syntax
bool cancelEvent ( )Returns
- bool: value
Always returns true .
Code Examples
client
This example prevents any damage to a player clientside by makingcancelEventan event handler for theonClientPlayerDamageevent.
function onClientPlayerDamage() cancelEvent()endaddEventHandler("onClientPlayerDamage", root, onClientPlayerDamage)