Guest User

Untitled

a guest
Feb 7th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. public SetPlayerHealthEx(playerid, Float:hp);
  2. {
  3. Health[playerid] = hp;
  4. return SetPlayerHealth(playerid, hp);
  5. }
  6.  
  7. public SetPlayerArmourEx(playerid, Float:ar);
  8. {
  9. Armour[playerid] = ar;
  10. return SetPlayerArmour(playerid, ar);
  11. }
  12.  
  13. //to onplayergivedamage
  14. if(damagedid != INVALID_PLAYER_ID)
  15. {
  16. if(!IsPlayerDead[damagedid)
  17. {
  18. new Float: HP, Float: AP;
  19.  
  20. GetPlayerHealthEx(damagedid,HP);
  21. GetPlayerArmourEx(damagedid,AP);
  22.  
  23. if ( AP >= amount )
  24. {
  25. SetPlayerArmourEx ( damagedid, AP - amount );
  26. }
  27. else if ( AP <= 0 )
  28. {
  29. new Float: remainHP = HP - amount;
  30. SetPlayerHealthEx ( damagedid, remainHP );
  31. if ( remainHP <= 1 )
  32. {
  33. OnPlayerDeath( damagedid, playerid, weaponid );
  34. SetPlayerHealthEx ( damagedid, 0.0 );
  35. IsPlayerDead[damagedid] = true;
  36. }
  37. }
  38. else
  39. {
  40. new Float: remainHP = HP + ( AP - amount );
  41. SetPlayerArmourEx ( damagedid, 0.0 );
  42. SetPlayerHealthEx ( damagedid, remainHP );
  43. if ( remainHP <= 1 )
  44. {
  45. OnPlayerDeath( damagedid, playerid, weaponid );
  46. SetPlayerHealthEx ( damagedid, 0.0 );
  47. IsPlayerDead[damagedid] = true;
  48. }
  49. }
  50. }
  51. return 1;
  52. }
Add Comment
Please, Sign In to add comment