FrenchCat Posted June 7, 2018 Share Posted June 7, 2018 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 : http://wiki.sa-mp.com/wiki/OnPlayerTakeDamagehttps://wiki.multitheftauto.com/wiki/OnPlayerDamage 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 :https://wiki.rage.mp/index.php?title=PlayerDamagehttps://wiki.rage.mp/index.php?title=Entity::hasBeenDamagedBy 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 ! Link to comment Share on other sites More sharing options...
misco Posted June 25, 2018 Share Posted June 25, 2018 Sup, 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now