Guest User

MaTrIx4057

a guest
Dec 23rd, 2011
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.90 KB | None | 0 0
  1. public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
  2. {
  3.     if(GetPlayerTeam(playerid) != GetPlayerTeam(damagedid))
  4.     {
  5.         if(damagedid != INVALID_PLAYER_ID)
  6.         {
  7.             new Float:HEALTH;
  8.             new Float:ARMOR;
  9.             new Float:DAMAGE;
  10.             GetPlayerArmour(damagedid, ARMOR);
  11.             GetPlayerHealth(damagedid, HEALTH);
  12.             if(ARMOR > 0)
  13.             {
  14.                 if(amount > ARMOR)
  15.                 {
  16.                     DAMAGE = amount - ARMOR;
  17.                     HEALTH = HEALTH - DAMAGE;
  18.                     SetPlayerArmour(damagedid, 0.0);
  19.                     SetPlayerHealth(damagedid, HEALTH);
  20.                     return 1;
  21.                 }
  22.                 ARMOR = ARMOR - amount;
  23.                 SetPlayerArmour(damagedid, ARMOR);
  24.             }
  25.             if(ARMOR < 1)
  26.             {
  27.                 HEALTH = HEALTH - amount;
  28.                 SetPlayerHealth(damagedid, HEALTH);
  29.             }
  30.         }
  31.     }
  32.     return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment