09.04.2016, 18:58
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 :
Well it works, but is there a way to do it without timer?
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;
}

