Help regarding PlayerDamage & hasBeenDamagedBy

Recommended Posts

Hello guys,
I used to make some simple scripts on SAMP/MTA and I would like you to take a look at those two events :

As you can see when someone gets injured we get interesting parameters such as the player that caused the damage and the weapon that he used.
I would like to get the same infos on RAGE:MP (when a player gets injured I want to know who is the other player that injured him).

From what I understand I will have to play around with those two things :
But to be honest I have no clue how to use hasBeenDamagedBy, and it also looks like PlayerDamage is a server side-event and hasBeenDamagedBy is a client-side function so there are some tricky stuff to do to make them work together and I have no clue how to do it.

It would have been nice if there was an "attacker" parameter in the PlayerDamage event, just like PlayerDeath has a "killer" parameter.
Some help regarding what I want to achieve would be very nice !

Thank you ! ^_^

Share this post

Link to post
Share on other sites


i would consider rage mp's PlayerDamage event more like some kind of 'PlayerHealthChange' event. It is emitted when players health decreases. There is an idea to be tested(i am not sure if available functions work) once PlayerDamage triggered

  • entity.hasBeenDamagedBy(entity2, p2);  - cycle through all players/vehicle entities used by players eventually and try to find entity that damaged the player for who is PlayerDamage event triggered
  • player.getLastDamageBone(outBone); - optionally get last damaged bone

and work with obtained data, then always clear damage data with these:

  • player.clearLastDamageBone();
  • entity.clearLastDamage();


This is just an idea how you could achieve this, i do not have time to test it in game currently. Good luck


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.