make a timer refill hp
#1

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;
}
Reply
#2

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

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?
Reply
#4

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

Where is your 'heal' function/callback?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)