-
-
Notifications
You must be signed in to change notification settings - Fork 497
Add event onElementHealthChange #3152
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
Add event onElementHealthChange #3152
Conversation
Hi, thanks for the PR!
SA changes entity health directly as well, so this implementation doesn't cover all cases.
The only way you could make this event work reliably is to dispatch it from the net code [since it tracks entity health for sync].
...b.com/znvjder/mtasa-blue into feature/on(Client)ElementHealthChange
Almost after a month's break, lol. I decided to use a server-side event only. It is the most accurate and insta calls when the health value changes. Works for player, ped, vehicle and object.
As @Pirulax mentioned, I think it would be nice for onElementHealthChange to trigger whenever element health changes, so not just via setElementHealth, but also when changed in-game (from fall damage, explosion, etc). There should be a parameter to the event for whether it was changed via script.
Currently, regardless of the circumstances, this event will always be triggered. The parameter idea seems interesting.
Any update?
Currently, regardless of the circumstances, this event will always be triggered.
As i see it, this is useful enough (that it triggers in all cases) to be in MTA as-is, so i consider this PR pretty mature.
We can merge it now, and add parameters later, either by you or someone else. It will prevent this PR from becoming very stale.
For this line of action, please resolve conflicts, and thanks for all the effort!
Uh oh!
There was an error while loading. Please reload this page.
This PR adds the serverside event onElementHealthChange
I think this is an insignificant change for many people, but it will certainly make life easier for ours scripters.
Refers to #3136