Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: death handler #944

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

tomson701
Copy link

Faster and more optimized method of handling player dead

Faster and more optimized method of handling player dead
@tomson701 tomson701 requested a review from tabarra as a code owner April 9, 2024 18:22
@tabarra
Copy link
Owner

tabarra commented Apr 9, 2024

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
Copy link
Author

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
Copy link
Owner

tabarra commented May 8, 2024

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?

@tabarra tabarra added the Pending Tests Pending Tests label May 8, 2024
@tabarra tabarra changed the base branch from master to develop May 8, 2024 01:41
@AvarianKnight
Copy link
Contributor

AvarianKnight commented May 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending Tests Pending Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants