Something I don't understand with damages
#1

Hello. I've made this thing in OnPlayerTakeDamage:
Код:
    new Float:HP;
    new Float:armour;
    GetPlayerArmour(playerid, armour);
    GetPlayerHealth(playerid, HP);
    if (weaponid == 24) {
    	if (armour > 0) {
  	  	SetPlayerArmour(playerid, armour-40);
  	  	SetPlayerHealth(playerid, HP-5);
		}
		else if (armour < 0) {
		SetPlayerHealth(playerid, HP-20);//DesertEagle
		}
	}
If the player has no armour, the server is going to give him one to make the armour lose, I simply need help on it. Thank you.
Reply
#2

This

pawn Код:
else if (armour < 0) {
should be just

pawn Код:
else {
Reply
#3

If their armour is 5 and health is 100 and 10 damage is dealt, they should end up with 95 health and 0 armour, so you need some simple subtraction maths.
Reply
#4

Same thing, armour comes back
Reply
#5

Anything else?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)