SA-MP Forums Archive
Health Regen - 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)
+--- Thread: Health Regen (/showthread.php?tid=279762)



Health Regen - Oh - 28.08.2011

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(gTeam[i] == EHUMANO)
		{
			if(PlayerInfo[i][jProfesion] == 4)
			{
			    new Float:PlayerHealth;
			    new Health = GetPlayerHealth(i, PlayerHealth);
			    if(Health < 79)
				{
			    	SetPlayerHealth(i, PlayerHealth+3);
			   	}
Alright so I'm not understanding why it's bugging out hardcore. I was wondering if anyone could re-code this small function in order for it to properly work?


Re: Health Regen - LetsOWN[PL] - 29.08.2011

pawn Код:
SetTimerEx("GimmeHeal", 4000, 1, "d", playerid); // Example in OnPlayerConnect

forward GimmeHeal(playerid); //Anywhere
public GimmeHeal(playerid)
{
    if(gTeam[playerid] == EHUMANO)
    {
        if(PlayerInfo[i][jProfesion] == 4)
        {
            new Float:HP
            GetPlayerHealth(playerid, HP);
            SetPlayerHealth(playerid, HP+3);
        }
    }
    return 1;
}
One question..
[pawno] new Float:PlayerHealth;
new Health = GetPlayerHealth(i, PlayerHealth);
[/pawno]
Why you definted twice 'Health' float?
"new Health" Why you did this, if you defined above:
"new Float:PlayerHealth" ?

Emm?


Re: Health Regen - Oh - 05.09.2011

--- - Copy.pwn(2799) : error 017: undefined symbol "playerid"
--- - Copy.pwn(22025) : error 017: undefined symbol "i"
--- - Copy.pwn(2202 : error 001: expected token: ";", but found "-identifier-"

22028 = GetPlayerHealth(playerid, HP);
22025 = if(PlayerInfo[i][jProfesion] == 4)
2799 = SetTimerEx("GimmeHeal", 4000, 1, "d", playerid);


Re: Health Regen - =WoR=Varth - 05.09.2011

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(gTeam[i] == EHUMANO)
        {
            if(PlayerInfo[i][jProfesion] == 4)
            {
                new Float:PlayerHealth;
                GetPlayerHealth(i,PlayerHealth);
                if(PlayerHealth < 79)
                {
                    SetPlayerHealth(i,PlayerHealth+3);
                }