Regenerate HP
#7

Quote:
Originally Posted by gotwarzone
Посмотреть сообщение
So how do you make it stop when he reach 100% of health?
like this
(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;
}
additional note:i didn't code for months but the code should be okey, i guess...
Reply


Messages In This Thread
Regenerate HP - by Blackazur - 02.03.2014, 16:36
Re: Regenerate HP - by Clad - 02.03.2014, 16:37
AW: Regenerate HP - by Blackazur - 02.03.2014, 16:42
Re: Regenerate HP - by Psyhophatic - 02.03.2014, 16:47
Re: Regenerate HP - by MP2 - 03.03.2014, 06:53
Re: Regenerate HP - by gotwarzone - 03.03.2014, 06:54
Re: Regenerate HP - by CutX - 03.03.2014, 07:14

Forum Jump:


Users browsing this thread: 3 Guest(s)