SA-MP Forums Archive
Player gets over 100% health - 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: Player gets over 100% health (/showthread.php?tid=325153)



Player gets over 100% health - Dripac - 12.03.2012

pawn Код:
new Float:Leben;
                    GetPlayerHealth(playerid,Leben);
                    SetPlayerHealth(playerid,Leben +10);
                    SendClientMessage(playerid, COLOR_PLAVA, "Du hast einen Hamburger bestellt.");
                    GivePlayerCash(playerid,-10);
                    GameTextForPlayer(playerid, "~r~ -10Ђ", 3000, 1);
How can i limit it, so the player can only have 100 % health and not more


Re: Player gets over 100% health - Babul - 12.03.2012

pawn Код:
new Float:Leben;
GetPlayerHealth(playerid,Leben);
Leben+=10.0:
if(Leben>100.0)
{
    Leben=100.0;
}
SetPlayerHealth(playerid,Leben);
SendClientMessage(playerid, COLOR_PLAVA, "Du hast einen Hamburger bestellt.");
GivePlayerCash(playerid,-10);
GameTextForPlayer(playerid, "~r~ -10€", 3000, 1);



Re: Player gets over 100% health - Dripac - 12.03.2012

I get errors on line 36558 and 36559

pawn Код:
Leben+=10.0:
f(Leben>100.0)



Re: Player gets over 100% health - Babul - 12.03.2012

oops, i typed a : instead a ;
pawn Код:
Leben+=10.0;