Advertisement
spenzo

Weapon Damage System V3

Aug 13th, 2011
2,693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
  2. {
  3. new TargetName[MAX_PLAYER_NAME];
  4. new ShooterName[MAX_PLAYER_NAME];
  5. GetPlayerName(Target,TargetName,MAX_PLAYER_NAME);
  6. GetPlayerName(Shooter,ShooterName,MAX_PLAYER_NAME);
  7. new gun=GetPlayerWeapon(Shooter);
  8. new string[128];
  9. new wepname[30];
  10. GetWeaponName(gun,wepname,sizeof(wepname));
  11. format(string,sizeof(string),"~n~~n~~w~You hit ~r~%s ~w~Damage:~r~ %i ~w~Weapon:~r~%s",TargetName,floatround(HealthLost+ArmourLost),wepname);
  12. GameTextForPlayer(Shooter,string,3000,5);
  13. format(string,sizeof(string),"~n~~n~~w~You got hit by ~r~%s ~w~Damage:~r~ %i ~w~Weapon:~r~%s",ShooterName,floatround(HealthLost+ArmourLost),wepname);
  14. GameTextForPlayer(Target,string,3000,5);
  15. new Float:health, Float:armour;
  16. GetPlayerHealth(Target,health);
  17. GetPlayerArmour(Target,armour);
  18. if(ArmourLost > 0.0) SetPlayerArmour(Target,floatadd(armour,ArmourLost));
  19. if(HealthLost > 0.0) SetPlayerHealth(Target,floatadd(health,HealthLost));
  20. new Damage;
  21. switch(GetPlayerWeapon(Shooter)) {
  22. case 24: Damage = 40; //case [weaponid]: Damage = [damage];
  23. case 31,28: Damage = 25; //Tec9 & Micru-Uzi
  24. case 29: Damage = 30;
  25. case 0: Damage = 7;
  26. case 22: Damage = 25;
  27. case 23: Damage = 20;
  28. case 5,3,6,7,2: Damage = 10;
  29. case 4: Damage = 30;
  30. case 25: Damage = 50;
  31. case 26: Damage = 50;
  32. case 30: Damage = 30;
  33. case 33,34: Damage = 95;
  34. }
  35. armour = armour - Damage;
  36. if(armour < 0.0) {
  37. health += armour; //Health will decrease because armour is negative. (a + (-b) = a - b)
  38. if(health <= 0.0) {
  39. health = 0.0;
  40. }
  41. armour = 0.0;
  42. }
  43. SetPlayerHealth(Target, health);
  44. SetPlayerArmour(Target, armour);
  45. return 1;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement