Help with weapon damage system thanks
#5

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.

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);
}
This is untested but should work, unless I have missed something. If anyone finds anything wrong. Fell free to correct it.
Reply


Messages In This Thread
Help with weapon damage system thanks - by JessThompson - 14.07.2014, 20:26
Re: Help with weapon damage system thanks - by JessThompson - 14.07.2014, 20:45
Re: Help with weapon damage system thanks - by Don_Cage - 14.07.2014, 21:07
Re: Help with weapon damage system thanks - by JessThompson - 14.07.2014, 21:25
Re: Help with weapon damage system thanks - by azzerking - 14.07.2014, 22:16
Re: Help with weapon damage system thanks - by JessThompson - 15.07.2014, 11:56
Re: Help with weapon damage system thanks - by JessThompson - 15.07.2014, 12:18
Re: Help with weapon damage system thanks - by Pottus - 15.07.2014, 13:01

Forum Jump:


Users browsing this thread: 1 Guest(s)