if player health 100
#10

You guys are making that a lot more complicated than it has to be. What does 0.1-99.9 equal? Anything less than one hundred; so all you need is a less-than operator.

In the code below, the player gets an error message if their HP is greater than or equal to 100. If it is lower (else), it heals them (granted that they have at least 100 dollars to spend, I added that check in there myself).
pawn Код:
else if(clickedid == Heal) //Hospital
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    if (health >= 100.0) return SendClientMessage(playerid, COLOR_WHITE, "Your health is already full.");
    else {
        if(GetPlayerMoney(playerid) >= 100) {
            GivePlayerMoney(playerid,-100);
            SetPlayerHealth(playerid, 100);
            SendClientMessage(playerid, COLOR_WHITE, "You have healed yourself."); }
        else return SendClientMessage(playerid, COLOR_WHITE, "Youson't have the cash to heal yourself.");
    }
}
Reply


Messages In This Thread
if player health 100 - by HardBoy - 28.09.2012, 14:05
Re: if player health 100 - by Face9000 - 28.09.2012, 14:09
Re: if player health 100 - by HardBoy - 28.09.2012, 14:31
Re: if player health 100 - by HardBoy - 28.09.2012, 14:44
Re: if player health 100 - by [rG]Cold - 28.09.2012, 14:46
Re: if player health 100 - by SuperViper - 28.09.2012, 14:46
Re: if player health 100 - by HardBoy - 28.09.2012, 14:48
Re: if player health 100 - by Danyal - 28.09.2012, 15:20
Re: if player health 100 - by HardBoy - 28.09.2012, 15:58
Re: if player health 100 - by zDevon - 28.09.2012, 17:34

Forum Jump:


Users browsing this thread: 1 Guest(s)