iPaulinho

[Código] No-Lag

Nov 24th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.37 KB | None | 0 0
  1. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
  2. {
  3.     new Float:Life, Float:Coleete, Float:Dano;
  4.     GetPlayerArmour(damagedid, Coleete);
  5.     GetPlayerHealth(damagedid, Life);
  6.     if(Coleete > 0)
  7.     {
  8.         if(amount > Coleete)
  9.         {
  10.             Dano = amount - Coleete;
  11.             Life = Life - Dano;
  12.             SetPlayerArmour(damagedid, 0.0);
  13.             SetPlayerHealth(damagedid, Life);
  14.             return 1;
  15.         }
  16.         Coleete = Coleete - amount;
  17.         SetPlayerArmour(damagedid, Coleete);
  18.     }
  19.     if(Coleete < 1)
  20.     {
  21.         Life = Life - amount;
  22.         SetPlayerHealth(damagedid, Life);
  23.     }
  24.     return 1;
  25. }
  26.  
  27. // Código feito por: Smith.
  28.  
  29. // Código mais otimizado:
  30. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid) {
  31.     new Float: Life[2];
  32.     GetPlayerHealth(damagedid, Life[0]);
  33.     GetPlayerArmour(damagedid, Life[1]);
  34.     if(Life[1]) {
  35.         if(amount > Life[1]) {
  36.             Life[0] = Life[0] - (amount - Life[1]);
  37.             SetPlayerArmour(damagedid, 0.0);
  38.             SetPlayerHealth(damagedid, Life[0]);
  39.             return 1;
  40.         }
  41.         Life[1] = Life[1] - amount;
  42.         SetPlayerArmour(damagedid, Life[1]);
  43.     } else {
  44.        Life[0] = Life[0] - amount;
  45.         SetPlayerHealth(damagedid, Life[0]);
  46.     }
  47.     return 1;
  48. }
  49.  
  50. // Código feito por: Paulor.
Advertisement
Add Comment
Please, Sign In to add comment