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

Add event onElementHealthChange #3152

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

znvjder
Copy link
Contributor

@znvjder znvjder commented Aug 11, 2023

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

@lopezloo lopezloo added the enhancement New feature or request label Aug 13, 2023
@Pirulax
Copy link
Contributor

Pirulax commented Aug 13, 2023

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].

@znvjder
Copy link
Contributor Author

znvjder commented Sep 16, 2023

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.

@znvjder znvjder changed the title Add event onElementHealthChange and onClientElementHealthChange Add event onElementHealthChange Sep 16, 2023
@Lpsd
Copy link
Member

Lpsd commented Oct 6, 2023

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.

@znvjder
Copy link
Contributor Author

znvjder commented Oct 11, 2023

Currently, regardless of the circumstances, this event will always be triggered. The parameter idea seems interesting.

@TracerDS
Copy link
Contributor

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants