09.07.2011, 11:23
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.
Thanks for your help.
regards,
nescha
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;
}
regards,
nescha