new Float:Health[MAX_PLAYERS];
new Float:Armour[MAX_PLAYERS];
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
// Here the health & armour are reduced from the array
new Float:hp, Float:ap;
GetPlayerHealth(playerid, hp);
GetPlayerArmour(playerid, ap);
if(Health[playerid] != hp || Armour[playerid] != ap) return AddBan(playerid, RPN(playerid), "Anti Cheat", "Health Hacking", RPIP(playerid));
return 1;
}
if (Armour[playerid] > amount) Armor[playerid] -= amount; else if (Armour[playerid]) { amount - Armour[playerid]; Armour[playerid] = 0.0; if (amount) { if (Health[playerid] > amount) Health[playerid] -= amount; else Health[playerid] = 0.0; } } else if (Health[playerid] > amount) Health[playerid] -= amount; else Health[playerid] = 0.0;
I guess you want to do it like this?
Код:
if (Armour[playerid] > amount) Armor[playerid] -= amount; else if (Armour[playerid]) { amount - Armour[playerid]; Armour[playerid] = 0.0; if (amount) { if (Health[playerid] > amount) Health[playerid] -= amount; else Health[playerid] = 0.0; } } else if (Health[playerid] > amount) Health[playerid] -= amount; else Health[playerid] = 0.0; |