Player gets over 100% health
#1

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
Reply
#2

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);
Reply
#3

I get errors on line 36558 and 36559

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)