Need help with /heal
#1

Hello Guys,
I've made ​​a command, which allows users to heal. It works nearly properly, but he does not recognize when the player has his live over 99. He Continue with the healing.

Exactly, I mean that he does not recognize when the player has his live over 99. How can I fix it? In the appendix you find my code.

pawn Код:
public HealStep1(playerid)
{
    if(GetDistanceBetweenPlayers(playerid,HealOffer[playerid]) < 5.0)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if (health > 99.0)
        {
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"* You were fully healed");
            KillTimer(HealStep1(playerid));
            KillTimer(HealStep2(playerid));
            return 1;
        }
        if (health < 100.0)
        {
            GivePlayerHealth(playerid, 10.0);
            SetTimerEx("HealStep2",1999,0,"d",playerid);
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_GREY,"The cure was canceled because you are too far away from the ambulance.");
        KillTimer(HealStep1(playerid));
        KillTimer(HealStep2(playerid));
        return 1;
    }
    return 1;
}

public HealStep2(playerid)
{
    if(GetDistanceBetweenPlayers(playerid,HealOffer[playerid]) < 5.0)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if (health > 99.0)
        {
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"* You were fully healed");
            KillTimer(HealStep1(playerid));
            KillTimer(HealStep2(playerid));
            return 1;
        }
        if (health < 100.0)
        {
            GivePlayerHealth(playerid, 10.0);
            SetTimerEx("HealStep1",1999,0,"d",playerid);
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_GREY,"The cure was canceled because you are too far away from the ambulance.");
        KillTimer(HealStep1(playerid));
        KillTimer(HealStep2(playerid));
        return 1;
    }
    return 1;
}
Thanks for your help.

regards,
nescha
Reply


Messages In This Thread
Need help with /heal (HelpStep and health > 99.0) didnt works - by nescha - 09.07.2011, 11:23
Re: Need help with /heal - by [MG]Dimi - 09.07.2011, 13:01
Re: Need help with /heal - by nescha - 09.07.2011, 13:47
Re: Need help with /heal - by =WoR=Varth - 09.07.2011, 18:05

Forum Jump:


Users browsing this thread: 1 Guest(s)