Giving player health up to 99
#1

I want to create function that would give player health up to 99. For example if player has 80 health and I use GivePlayerHealth(playerid, 40) it would set player health to 99 and not to 120.

I tried something like this :

Код:
stock GivePlayerHealth(playerid,Float:Health)
{
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+Health+1);
SetTimerEx("MinusHp", 50, false, "i", playerid); // It doesnt work if you take -1 health right away
}

forward MinusHp(playerid);
public MinusHp(playerid)
{
new Float:health;
GetPlayerHealth(playerid,health);
if(health>99)
{
SetPlayerHealth(playerid, 99);
}
return 1;
}
Well it works, but is there a way to do it without timer?
Reply


Messages In This Thread
Giving player health up to 99 - by ax1 - 09.04.2016, 18:58
Re: Giving player health up to 99 - by AndySedeyn - 09.04.2016, 19:33
Re: Giving player health up to 99 - by Vanter - 09.04.2016, 19:38

Forum Jump:


Users browsing this thread: 1 Guest(s)