Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
znvjder wants to merge 10 commits into multitheftauto:master
base: master
Choose a base branch
Loading
from znvjder:feature/on(Client)ElementHealthChange

Conversation

@znvjder
Copy link
Contributor

@znvjder znvjder commented Aug 11, 2023
edited
Loading

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

Pirulax commented Aug 13, 2023
edited
Loading

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

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

TracerDS and matheustkn reacted with thumbs up emoji

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.

Copy link
Contributor

Any update?

Copy link
Member

Dutchman101 commented Mar 16, 2025
edited
Loading

@znvjder:

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!

@FileEX FileEX added the stale Inactive for over 90 days, to be closed label Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tederis tederis tederis left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

enhancement New feature or request stale Inactive for over 90 days, to be closed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /