SA-MP Forums Archive
Something I don't understand with damages - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Something I don't understand with damages (/showthread.php?tid=347573)



Something I don't understand with damages - Amator - 02.06.2012

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.


Re: Something I don't understand with damages - MadeMan - 02.06.2012

This

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

pawn Код:
else {



Re: Something I don't understand with damages - MP2 - 02.06.2012

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.


Re : Something I don't understand with damages - Amator - 02.06.2012

Same thing, armour comes back


Re : Something I don't understand with damages - Amator - 02.06.2012

Anything else?