03.03.2014, 07:14
like this
(gonna use ytimers)
additional note:i didn't code for months but the code should be okey, i guess...
(gonna use ytimers)
pawn Код:
//global timer var
new Timer:health_T[MAX_PLAYERS];//declaring a timer var
//start the timer from somewhere.. idk.. maybe a command?
health_T[playerid] = repeat health(playerid);//asign that repeat timer's id to the player var
//the timer itself, !outside! just like a function, that's what these timers are
timer health[3000](playerid)//getting called for that player every 3 seconds
{
new float:ckh;
GetPlayerHealth(playerid,ckh);
if(ckh > 100)
{
SetPlayerHealth(playerid,100);//set it to 100, cuz it might be 101. You can cut that out ofc since the difference between 100 and 101 isn't rly much
stop health_T[playerid];//stop the timer
}
else
{
SetPlayerHealth(playerid,ckh+2);
}
return 1;
}