02.04.2012, 03:04
(
Last edited by [ABK]Antonio; 25/03/2013 at 06:21 AM.
)
I would do something along the lines of this.
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:stat[2];
GetPlayerHealth(playerid, stat[0]);
GetPlayerArmour(playerid, stat[1]);
new Damage;
switch(weaponid)
{
case 31: Damage = 25; //set the damage here for when this switch is over
}
if(stat[1] > Damage) SetPlayerArmour(playerid, stat[1]-Damage);
else if(stat[1] == Damage) SetPlayerArmour(playerid, 0);
else if(stat[1] < Damage && stat[1] > 0)
{
new subval = floatround(stat[1])-Damage;
//takes their armor, subtracts 25 from it. Then it adds that negative number to their health
//For instance, 15 armor -25 = -10. So we subract 10 basically.
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, stat[0]+subval);
}
else SetPlayerHealth(playerid, stat[0]-Damage);
return 1;
}