tabarra / txAdmin

The official FiveM server management platform used by over 23k servers!
https://txadmin.gg/
MIT License
803 stars 540 forks source link

refactor: death handler #944

Closed tomson701 closed 2 weeks ago

tomson701 commented 5 months ago

Faster and more optimized method of handling player dead

tabarra commented 5 months ago

Thanks for the PR

I'm not familiar with those events.
Would that event also trigger when a death is not from a particular damage? Maybe script-caused death or something.
Also, why not CEventDeath instead?

tomson701 commented 5 months ago

CEventDeath is not being triggered when you death in my case. It's handle dead from everything as far as i know. Also this event is being used in ESX Legacy and works fine for me.

tabarra commented 4 months ago

Searching on github for CEventNetworkEntityDamage shows that nobody agrees on what the parameters are.
Here for me on b2944 the parameter that indicates if the player died is data[6], maybe that's not consistent across game versions?

Also, does this even work on RedM?

AvarianKnight commented 4 months ago

Does CEventPlayerDeath also not work for this situation? It would be nice to be able to use something that wont be triggered a bunch by other stuff.

Its also probably better to use the specific event as the handler instead of using gameEventTriggered

This should work like this:

AddEventHandler("CEventNetworkEntityDamage", function(data)

end)

This got added a few years ago and be less spammy then gameEventTriggered