shared
CancelEvent
FiveM shared native documentation with a Lua example.
Summary
Cancels the currently handled event where cancellation is supported (e.g. some game events, entity creation). Used to block unwanted default behavior.
Returns
void
Example
AddEventHandler('entityCreating', function(entity)
if IsThisBad(entity) then
CancelEvent()
end
end)Common pitfalls
- Only works inside events that support cancellation.
- Common in anti-cheat / entity governance to block disallowed spawns.
Related natives
Related guides
Need protected areas on your map?
Viper Safe-Zone draws polygon safe zones in-game — no hand-edited coordinates — with weapon, combat and vehicle-speed rules per zone.
See Viper Safe-Zone →