Guest User

Untitled

a guest
Jun 7th, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1.  
  2. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
  3. {
  4. if(damagedid != INVALID_PLAYER_ID)
  5. {
  6. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return 1;
  7. if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID) return 1;
  8. if(PlayerInfo[playerid][pDamageInformer] > 0) {
  9. new str[128];
  10. format(str, sizeof(str), "~g~%.0f", amount);
  11. GameTextForPlayer(playerid, str, 1500, 3);
  12. }
  13. if(amount < 0)
  14. {
  15. new string[128],sendername[25];
  16. GetPlayerName(playerid,sendername,sizeof(sendername));
  17. format(string,sizeof(string),"{f03337}Warning: %s (%d) it is possible to use global kill, health amount given: %.2f.",sendername,playerid,amount);
  18. ABroadCast(COLOR_WHITE,string,1);
  19. KickEx(playerid);
  20. return 1;
  21. }
  22. if(playerdeath[damagedid] == 0)
  23. {
  24. if(weaponid == 34)
  25. {
  26. SetPlayerHealthEx(damagedid, 0.0);
  27. SetPlayerArmourEx(damagedid, 0.0);
  28. OnPlayerDeath(damagedid,playerid,weaponid);
  29. playerdeath[damagedid] = 1;
  30. return 1;
  31. }
  32. new Float: HP[MAX_PLAYERS], Float: AP[MAX_PLAYERS], Float:remainHP[MAX_PLAYERS];
  33. GetPlayerHealthEx(damagedid,HP[damagedid]);
  34. GetPlayerArmourEx(damagedid,AP[damagedid]);
  35. if ( AP[damagedid] >= amount )
  36. {
  37. SetPlayerArmourEx ( damagedid, AP[damagedid] - amount );
  38. }
  39. else if ( AP[damagedid] <= 0 )
  40. {
  41. remainHP[damagedid] = HP[damagedid] - amount;
  42. SetPlayerHealthEx ( damagedid, remainHP[damagedid] );
  43. if ( remainHP[damagedid] <= 0 )
  44. {
  45. OnPlayerDeath( damagedid, playerid, weaponid );
  46. playerdeath[damagedid] = 1;
  47. return 1;
  48. }
  49. }
  50. else
  51. {
  52. remainHP[damagedid] = HP[damagedid] + ( AP[damagedid] - amount );
  53. SetPlayerArmourEx ( damagedid, 0.0 );
  54. SetPlayerHealthEx ( damagedid, remainHP[damagedid] );
  55. if ( remainHP[damagedid] <= 0 )
  56. {
  57. OnPlayerDeath( damagedid, playerid, weaponid );
  58. playerdeath[damagedid] = 1;
  59. return 1;
  60. }
  61. }
  62. if(pingsound[playerid] == 1)
  63. {
  64. PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
  65. }
  66. if(PlayerCuffed[damagedid] == 1)
  67. {
  68. SetPlayerHealthEx(damagedid,100);
  69. }
  70. if(PlayerInfo[damagedid][pSleeping] == 1)
  71. {
  72. SetPlayerHealthEx(damagedid, 100);
  73. }
  74. new string[128], weapon[128];
  75. GetWeaponName(GetPlayerWeapon(playerid), weapon, 128);
  76. format(string, sizeof(string), "Damage given: %s (%d) - %s - %.1f damage", GetName(damagedid), damagedid, weapon, amount);
  77. foreach(Player, i) {
  78. if(dmg[i] == playerid)
  79. SendClientMessage(i, COLOR_GRAD1, string);
  80. }
  81. if(tazer[playerid] == 1 && IsACop(playerid) && weaponid == 24)
  82. {
  83. SetPlayerHealthEx(damagedid, 100);
  84. if(IsACop(damagedid)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You cannot taze cops.");
  85. if(PlayerCuffed[damagedid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}This player is already tazed.");
  86. if(PlayerInfo[damagedid][pSleeping] == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Player is AFK.");
  87. if(GetDistanceBetweenPlayers(playerid,damagedid) < 15)
  88. {
  89. new sendername[25],giveplayer[25];
  90. GetPlayerName(playerid,sendername,sizeof(sendername));
  91. GetPlayerName(damagedid,giveplayer,sizeof(giveplayer));
  92. format(string, sizeof(string), "* You were Tazed by %s for 8 seconds.", sendername);
  93. SendClientMessage(damagedid, COLOR_LIGHTBLUE, string);
  94. format(string, sizeof(string), "* You Tazed %s for 8 seconds.", giveplayer);
  95. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  96. format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", sendername ,giveplayer);
  97. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  98. GameTextForPlayer(damagedid, "~r~~h~Tazed", 2500, 3);
  99. TogglePlayerControllable(damagedid, 0);
  100. PlayerCuffed[damagedid] = 1;
  101. PlayerCuffedTime[damagedid] = 8;
  102. }
  103. }
  104. }
  105. }
  106. return 1;
  107. }
Advertisement
Add Comment
Please, Sign In to add comment