wasEventCancelled | Multi Theft Auto: Wiki Skip to content

wasEventCancelled

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function checks if the last completed event was cancelled. This is mainly useful for custom events created by scripts.

Syntax

wasEventCancelled ( )

Code Examples

server

This example implements a custom eventonFlagPickupthat would be triggered if anonMarkerHitevent was triggered on a marker whose parent was aflagelement. If the event isn't canceled then an element data value is set on the player.

addEvent ( "onFlagPickup", true )
function flagHitcheck ( thePlayer )
parentElement = getElementParent ( source ) -- get the parent of the marker
if ( getElementType ( parentElement ) == "flag" ) then -- if it was a flag element then
triggerEvent ( "onFlagPickup", source, thePlayer ) -- trigger our onFlagPickup event
if ( not wasEventCancelled() ) then -- if handlers for 'onFlagPickup' didn't cancel it then
setElementData ( thePlayer, "hasFlag", true ) -- set that the player picked up the flag
end
end
end
addEventHandler ( "onMarkerHit", getRootElement(), flagHitCheck )