13.11.2017, 17:12
I forgot to account for armor. I posted code for it when someone pointed it out.
http://forum.sa-mp.com/showpost.php?...3&postcount=59
PHP код:
new
playerArmor,
amoun;
GetPlayerArmour(playerid, playerArmor);
if(GetPlayerTeam(playerid) == PLAYER_STATE_ALIVE)
{
if(playerArmor > 0) // if their armor is greater than 0
{
amoun = playerArmor - amount; // player's armor - amount of damage taken
if(amoun <= 0) // if armor - amount taken is less than or equal to 0
SetPlayerHealth(playerid, playerHealth - amount); // health is set
else
{
if(bodypart != BODY_PART_HEAD && bodypart != BODY_PART_RIGHT_LEG && bodypart != BODY_PART_LEFT_LEG)
SetPlayerArmour(playerid, amoun); // if the bodypart doesn't equal head, left/right leg, we'll set their armor down
else SetPlayerHealth(playerid, playerHealth - amount); // else their armor is taken down
}
}
else SetPlayerHealth(playerid, playerHealth - amount);
}