Shopping Cart

intercepting game events (such as explosions) โ€“ FiveM Cookbook

The latest version of the server (1543+) added support for parsing and preventing routing of game events. This currently only supports parsing CExplosionEvent, but this might be a fairly useful one to prevent routing of โ€˜excessiveโ€™ explosions, or explosions that are โ€˜too closeโ€™ to a player and not of the correct weapon type.

Hereโ€™s an example:

-- SERVER script, requires OneSync!
AddEventHandler('explosionEvent', function(sender, ev)
    print(GetPlayerName(sender), json.encode(ev))

Thisโ€™ll show JSON data similar to the following:


If you want to, say, make an explosion-free zone:

AddEventHandler('explosionEvent', function(sender, ev)
    if ev.posX > 2000.0 and ev.posY > 2000.0 and ev.posX < 3000.0 and ev.posY < 3000.0 then

This can be used in a variety of ways โ€“ rate limiting, automatic warning/kicking, disabling routing of bad explosions, etc.

Leave a Reply
FiveM ESX Scripts

The best scripts and maps

Best support

Problems? We are there to help!

Wide range of products

We have a wide range of products

100% Secure Checkout

Easy and encrypted