Advertisement
Guest User

Untitled

a guest
Mar 7th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.85 KB | None | 0 0
  1. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) {
  2.     if(damagedid != INVALID_PLAYER_ID) {
  3.         new Float: HP, Float: AP ;
  4.             GetPlayerHealthEx(damagedid,HP);
  5.             GetPlayerArmourEx(damagedid,AP);
  6.             if(AP >= amount) SetPlayerArmourEx (damagedid, AP - amount);
  7.             else if(AP <= 0) {
  8.                 new const Float: remainHP = HP - amount;
  9.                 SetPlayerHealthEx(damagedid, remainHP);
  10.                 if( remainHP <= 0 ) {
  11.                     OnPlayerDeath(damagedid, playerid, weaponid);
  12.                     playerDeath[damagedid] = 1;
  13.                     return 1;
  14.                 }
  15.             }
  16.             else {
  17.                 new const Float: remainHP = HP + (AP - amount);
  18.                 SetPlayerArmourEx(damagedid, 0.0);
  19.                 SetPlayerHealthEx(damagedid, remainHP);
  20.                 if( remainHP <= 0 )
  21.                 {
  22.                     OnPlayerDeath(damagedid, playerid, weaponid);
  23.                     playerDeath[damagedid] = 1;
  24.                     return 1;
  25.                 }
  26.             }          
  27.         }  
  28.     }
  29.     return 1;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement