KAyo Posted April 1, 2019 Share Posted April 1, 2019 I tried the PlayerDamage event on server and client side which only outputs a text to the chat for testing at first. But on both variants the events didnt got triggered. Why? mp.events.add("playerDamage", (player, healthLoss, armorLoss) => { mp.gui.chat.push("You lost: " + healthLoss); }); Link to comment Share on other sites More sharing options...
Peyman Posted April 7, 2019 Share Posted April 7, 2019 Same for me Link to comment Share on other sites More sharing options...
Flow Posted April 9, 2019 Share Posted April 9, 2019 function is broken... Link to comment Share on other sites More sharing options...
Jorhoto Posted May 4, 2019 Share Posted May 4, 2019 (edited) Hello, I have the same issue (using C#). Any workaround? Or shall I just move to node.js which seems better maintained? Thanks Edited May 4, 2019 by Jorhoto Link to comment Share on other sites More sharing options...
Legend Posted May 5, 2019 Share Posted May 5, 2019 (edited) Render and save health in variables. For example in JS: var lastHealth = 0; const localPlayer = mp.players.local; mp.events.add('render', function() { var healthLoss = 0; if(lastHealth != localPlayer.getHealth()) { healthLoss = lastHealth - localPlayer.getHealth(); lastHealth = localPlayer.getHealth(); } if(healthLoss > 0) { // your code } }); Edited May 5, 2019 by Legend Link to comment Share on other sites More sharing options...
Jorhoto Posted May 5, 2019 Share Posted May 5, 2019 (edited) Ok, so the workaround is to fabricate yourself the event. Thanks Edited May 5, 2019 by Jorhoto 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