OneSync: intercepting game events (such as explosions)

Originally published at:

The latest version of the Windows server 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…


Ok wow this is pretty fucking epic O.O

My hope is for this same method of verification to be able to be useable for all types of Client Events

Might be taxing but if not that would be megaepic

Good work team!


This looks pretty! Definitely use this :exploding_head:

Wow ! Anticheat update here i come !

We’re using Sticky Bombs to test the event, it triggers the event on the server side; however it doesn’t cancel the event to stop the explosion.

Any ideas?

AddEventHandler('explosionEvent', function(sender, ev)
    if (ev.damageScale ~= 0.0) then
            ev.damageScale = 0.0
            TriggerEvent('explosionEvent', sender, ev)

To add on to LanceGood’s post, this code whilst it does print the data, the event is not cancelled and explosions will still kill a player…

Such a shame, I was really looking forward to using this as soon as it came out…

AddEventHandler('explosionEvent', function(sender, ev)
    print(GetPlayerName(sender), json.encode(ev))

Weapon explosions are having a separate weapon damage event which is currently not hookable. This is mainly for script explosions as used by mass kill options in menus.


Does this mean using the above event will work for AddExplosion exploiting currently and stop all the modders from exploding using their menus? Also, is there an event which can handle all explosions?

Best Regards,

1 Like

The RPG will trigger this event.

Also, I’m currently having a problem with this event.
I’m getting spammed with apparently invalid explosions out of nowhere:

I’m thinking about just filtering out explosions with damageScale 0.

1 Like

Awesome. Please make other game event too like CreateVehicle, Ped ?


Might explain why most have stopped using explosions and now mass spawn vehicles on players, which is a difference I’ve noticed. Still, it is exciting and hope to see more from this.

We have protections on our server that prevents that & logs any that players may have made, so it is possible to make such.

I second this, along with GiveWeaponToPed

1 Like

entityCreated has existed for way, way longer than the explosion event, however?

I just found out about this earlier. Unfortunately, there isn’t anything on the forum regarding this, however?

Does it operate the same as the explosionEvent? for example:

AddEventHandler('entityCreated', function(sender, entity)
    print(GetPlayerName(sender), json.encode(entity))

As I cannot seem to find any documentation on this.


Found my answer:

AddEventHandler("entityCreated",  function(entity)
    print("Entity created" .. entity)

So let me try to understand this if I create a new resource add those lines I will be able to stop the modders from exploding my server and spawn different stuff ? Or at least find out who is doing this ? But the question is: if completely delete the lines from natives, this will not help me much more then stopping it or cancel the event, sorry if I sound stupid asking this but I’m not a scripter and I still learning

Hello, what is the point of this event if we cant get source from this? (to get the player that created the entity) in the explosion event we can get source, position and much more and here i tried to get source and no success



This is great, but you should also do something for the spawning props. Simply hackers will spawned an blimp in your head and it will explode and will no longer be detected by this. It would be perfect to have a list of BL objects and if someone uses the CreateObject Or the AtachToEntity Any of these objects, Notify an administrator or get kicked

how to fix weapon damage with onesync ?
like shotgun weapon !
without onesync all i need to kill some one it 1 bullet
with onesync i need more than 4 bullet to kill some one

how to fix this issue ?