22.03.2017, 20:33
Quote:
It's contradicting itself, I know that. I don't know how to write it properly, that's why I came here for help.
ANYWAYS, what it does is this: Код:
switch(armour) //Checks if player has armor. { if(armour <= 0) //Checks if player's armor is 0 or less than that. { case 0: //When Armor is 0, do whatever Код:
if(armour <= 0) //Checks if player's armor is 0 or less than that. { |
The code should be working if you remove these if checks, the errors happened because you skipped a bracket at the (weaponid == 34) condition. However, instead of filling the bracket, remove the unneeded conditions.
If the code just does not work and the user still gets their health taken when they should not, you may want to check in other callback like OnPlayerGiveDamage or OnPlayerWeaponShot.
EDIT:
Oopsey! I found a flaw, apparently if you put negative values in SetPlayerArmour it'll get to a positive value, then you will never get to have the player armour in 0.
The code provided by the guy above will help you to overcome this issue. Once again, if you're still having trouble, check for other callback.