14.07.2014, 22:16
The best way to do that is to check if the player armour is more then the you want to take off.
For example:
Your armour is: 30
Your health is 100
Your damage: 40
You first check to see if you have more armour then damage, if you have less then you get the player armour and take it away from the damage and then apply the remaining damage to health.
This is untested but should work, unless I have missed something. If anyone finds anything wrong. Fell free to correct it.
For example:
Your armour is: 30
Your health is 100
Your damage: 40
You first check to see if you have more armour then damage, if you have less then you get the player armour and take it away from the damage and then apply the remaining damage to health.
pawn Code:
new float:hp, float:armor;
GetPlayerHealth(playerid, hp);
GetPlayerArmor(playerid, armour);
if(armour > amount)
{
armour - amount;
SetPlayerArmor(playerid, armour);
}
else if(armour >= 0 && armour < amount)
{
amount - armour;
SetPlayerHealth(playerid, HP - amount);
}