Guest User

Untitled

a guest
Feb 12th, 2014
2,672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  4. {
  5. /* new Float:Velocity[3];
  6. GetPlayerVelocity(playerid, Velocity[0], Velocity[1], Velocity[2]);
  7. new Float:health, Float:armor;
  8. GetPlayerHealth(playerid, health);
  9. GetPlayerArmour(playerid, armor);
  10. SetPlayerArmour(playerid, armor);
  11. SetPlayerHealth(playerid, health);*/
  12. // Testing line endings
  13. if(GetPVarInt(issuerid, "tookdamagefrom") == playerid)
  14. {
  15. SetPlayerArmour(playerid, GetPVarFloat(issuerid, "tookdamagefrom2"));
  16. SetPlayerHealth(playerid, GetPVarFloat(issuerid, "tookdamagefrom1"));
  17. DeletePVar(issuerid, "tookdamagefrom");
  18. DeletePVar(issuerid, "tookdamagefrom1");
  19. DeletePVar(issuerid, "tookdamagefrom2");
  20. }
  21. return 1;
  22. }
  23.  
  24. public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
  25. {
  26. new Float:health, Float:armor;
  27. GetPlayerHealth(damagedid, health);
  28. GetPlayerArmour(damagedid, armor);
  29. SetPVarFloat(playerid, "tookdamagefrom1", health);
  30. SetPVarFloat(playerid, "tookdamagefrom2", armor);
  31. if(armor >= amount)
  32. {
  33. SetPlayerArmour(damagedid, armor-amount);
  34. SetPVarFloat(playerid, "tookdamagefrom2", armor-amount);
  35. }
  36. else
  37. {
  38. SetPlayerHealth(damagedid, health-amount);
  39. SetPVarFloat(playerid, "tookdamagefrom1", health-amount);
  40. }
  41. SetPVarInt(playerid, "tookdamagefrom", damagedid);
  42. return 1;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment