SA-MP Forums Archive
make a timer refill hp - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: make a timer refill hp (/showthread.php?tid=163905)



make a timer refill hp - omidi - 29.07.2010

hello .i want make a timer that when is player on death the tiimer
refill player health +5 hp auto per 5 sec and then if the player's hp refill to 50 then toggle player is 1, i do this
: where is wrong ?

Код:
forward heal();
 
this is under ongamemod
  SetTimer("heal",5000,0);

public OnPlayerDeath(playerid, killerid, reason)
{
 TogglePlayerControllable(playerid,0);

   new Float:health;
     GetPlayerHealth(playerid);
   heal =   SetPlayerHealth(playerid, health+5);
	if GetPlayerHealth(playerid)== 50) {
	 TogglePlayerControllable(playerid,1);
	SetPlayerPos(playerid,12002,1202,20);
  }

   	return 1;
}



Re: make a timer refill hp - mihaitza55 - 29.07.2010

How about adding SetTimer("heal",5000,0); under OnPlayerSpawn


Re: make a timer refill hp - iggy1 - 29.07.2010

As mihaitza55 suggested don't put the timer in OnPlayerDeath as it will only execute when a player dies the code would fail (if your trying to do what i think you are). what exactly are you trying to do?


Re: make a timer refill hp - omidi - 30.07.2010

how to make a timer refill player's hp 5 value per 10 sec ?


Re: make a timer refill hp - Hiddos - 30.07.2010

Where is your 'heal' function/callback?