Guest User

bgz

a guest
Mar 4th, 2017
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
  2. {
  3. if(damagedid != INVALID_PLAYER_ID)
  4. {
  5. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return 1;
  6. if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID) return 1;
  7. if(amount < 0)
  8. {
  9. new string[256],sendername[25];
  10. GetPlayerName(playerid,sendername,sizeof(sendername));
  11. format(string, sizeof(string), "(N) %s (%d, level %d) can use global kill, damage: %.2f.",sendername, playerid, PlayerInfo[playerid][pLevel], amount);
  12. ABroadCast(COLOR_RED,string,1);
  13. return 1;
  14. }
  15. if(PlayerInfo[playerid][pPaintBallG] > 0)
  16. {
  17. PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
  18. }
  19. new fpm,fkm;
  20. fpm = PlayerInfo[playerid][pMember];
  21. fkm = PlayerInfo[damagedid][pMember];
  22. for(new turf = 1; turf < sizeof(TurfInfo); turf++)
  23. {
  24. if(IsPlayerInTurf(playerid, turf) && IsPlayerInTurf(damagedid, turf))
  25. {
  26. if(IsAMember(playerid) && IsAMember(damagedid))
  27. {
  28. if(WarInfo[turf][wFaction] == fpm && WarInfo[turf][wAttacker] == fkm || WarInfo[turf][wFaction] == fkm && WarInfo[turf][wAttacker] == fpm)
  29. {
  30. PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
  31. }
  32. }
  33. }
  34. }
  35. if(PlayerInfo[damagedid][pPaintBallG] > 0)
  36. {
  37. if(paintrs[PlayerInfo[damagedid][pPaintBallG]] > 0)
  38. {
  39. SetPlayerHealthEx(damagedid, 100.0);
  40. }
  41. }
  42. if(playerdeath[damagedid] == 0)
  43. {
  44. if(weaponid == 34 && PlayerInfo[damagedid][pPaintBallG] < 1)
  45. {
  46. SetPlayerHealthEx(damagedid, 0.0);
  47. SetPlayerArmourEx(damagedid, 0.0);
  48. OnPlayerDeath(damagedid,playerid,weaponid);
  49. playerdeath[damagedid] = 1;
  50. return 1;
  51. }
  52. new Float: HP, Float: AP ;
  53. GetPlayerHealthEx(damagedid,HP);
  54. GetPlayerArmourEx(damagedid,AP);
  55. if ( AP >= amount )
  56. {
  57. SetPlayerArmourEx ( damagedid, AP - amount );
  58. }
  59. else if ( AP <= 0 )
  60. {
  61. new Float: remainHP = HP - amount;
  62. SetPlayerHealthEx ( damagedid, remainHP );
  63. if ( remainHP <= 1 )
  64. {
  65. OnPlayerDeath( damagedid, playerid, weaponid );
  66. SetPlayerHealthEx ( damagedid, 0.0 );
  67. playerdeath[damagedid] = 1;
  68. }
  69. }
  70. else
  71. {
  72. new Float: remainHP = HP + ( AP - amount );
  73. SetPlayerArmourEx ( damagedid, 0.0 );
  74. SetPlayerHealthEx ( damagedid, remainHP );
  75. if ( remainHP <= 1 )
  76. {
  77. OnPlayerDeath( damagedid, playerid, weaponid );
  78. SetPlayerHealthEx ( damagedid, 0.0 );
  79. playerdeath[damagedid] = 1;
  80. }
  81. }
  82. if(PlayerCuffed[damagedid] == 1)
  83. {
  84. SetPlayerHealthEx(damagedid,100);
  85. }
  86. if(PlayerInfo[damagedid][pSleeping] == 1)
  87. {
  88. SetPlayerHealthEx(damagedid, 100);
  89. }
  90. if(tazer[playerid] == 1 && IsACop(playerid) && weaponid == 23)
  91. {
  92. if(IsACop(damagedid)) return SendClientMessage(playerid, COLOR_GREY, "You can't taze a cop.");
  93. if(PlayerCuffed[damagedid] == 1) return SendClientMessage(playerid, COLOR_GREY, "This player is already tazed.");
  94. if(PlayerInfo[damagedid][pSleeping] == 1) return SendClientMessage(playerid, COLOR_GREY, "This player is sleeping.");
  95. if(GetDistanceBetweenPlayers(playerid,damagedid) < 15)
  96. {
  97. new string[126],sendername[25],giveplayer[25];
  98. GetPlayerName(playerid,sendername,sizeof(sendername));
  99. GetPlayerName(damagedid,giveplayer,sizeof(giveplayer));
  100. format(string, sizeof(string), "* %s tazed %s for 8 seconds.", sendername ,giveplayer);
  101. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  102. TogglePlayerControllable(damagedid, 0);
  103. PlayerCuffed[damagedid] = 1;
  104. PlayerCuffedTime[damagedid] = 8;
  105. }
  106. }
  107. }
  108. foreach(Player, i)
  109. {
  110. if(Spectate[i] == playerid)
  111. {
  112. if(PlayerInfo[i][pAdmin] >= 1)
  113. {
  114. if(ShowDMG[i] == 1)
  115. {
  116. new string[256],name[30],wName[64],name2[30];
  117. GetPlayerName(playerid, name, sizeof(name));
  118. GetPlayerName(damagedid, name2, sizeof(name2));
  119. GetWeaponNameEx(weaponid,wName,sizeof(wName));
  120. format(string, sizeof(string),"DMG: %s did %f damage to %s using weapon %s. [hit: %f %f %f] [bodypart: %d]",name,amount,name2,wName,DMInfo[playerid][0],DMInfo[playerid][1],DMInfo[playerid][2],bodypart);
  121. SendSplitMessage(i, COLOR_DARKPINK, string);
  122. }
  123. }
  124. }
  125. }
  126. }
  127. return 1;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment