CancelEvent

From Multi Theft Auto: Wiki
Revision as of 04:22, 11 September 2006 by Erorr404 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Dialog-information.png This article needs checking.

Reason(s): I'm making assumptions here.. Erorr404


This function is used to stop events from occuring when they otherwise would. When a player walks over a pickup for example, this function can stop them from getting it. cancelEvent is not compatible with all events.

Syntax

bool cancelEvent ()   

Usage

cancelEvent must be called from inside an event handler (a function that is called when an event is triggered).

Here is a list of compatible events:

  • onVehicleStartEnter

Returns

Returns true if the event was canceled successfully, false if the event is incompatible.

Example

This example stops the player huntedPlayer from entering a vehicle:

-- call 'stopVehicleEntry' whenever hunterPlayer is about to enter a vehicle:
addEventHandler ( "onVehicleStartEnter", huntedPlayer, "stopVehicleEntry" )
function stopVehicleEntry ( theplayer, seat, jacked )
   cancelEvent () -- stop the event from occuring
end

See Also