SA-MP Forums Archive
Brief help please! - 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: Brief help please! (/showthread.php?tid=249613)



Brief help please! - Andregood - 19.04.2011

I'd basically like someone to finish this code completely, I know I am not doing it completely right, so please help me finishing it, thanks.



Код:
#include <a_samp>
#define func


public OnPlayerSpawn(playerid)
func()
{
        if(team != 2) return 1;
        SetTimerEx("RegHP", 2000, true, "%i", playerid); //Should be at OnPlayerSpawn
    return 1;
}

forward RegHP(playerid);
public RegHP(playerid)
{
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    if(Health < 100) //To stop regernating if the player has 100 health or more


    {
        SetPlayerHealth(playerid, Health+1);
 	}



Re: Brief help please! - nuriel8833 - 19.04.2011

What do you want to do? Where? When? How?
Any info?


Re: Brief help please! - Andregood - 19.04.2011

Well I basically want to finish it, but I want somebody else to do it as I don't know how, so that I'll know in the future. I get errors when compiling that, I strongly suspect I've screwed up big-time but I'm not certain, that's why I want somebody to help me finish it, thanks.


Re: Brief help please! - Andregood - 19.04.2011

Bump


Re: Brief help please! - Emmet_ - 19.04.2011

pawn Код:
#include <a_samp>

public OnPlayerSpawn(playerid)
{
    func(playerid);
    return 1;
}

forward func(playerid);
public func(playerid)
{
    if(GetPlayerTeam(playerid) != 2) return 1;
    SetTimerEx("RegHP", 2000, true, "i", playerid); //Should be at OnPlayerSpawn
    return 1;
}

forward RegHP(playerid);
public RegHP(playerid)
{
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    if(Health < 100) //To stop regernating if the player has 100 health or more
    {
        SetPlayerHealth(playerid, Health+1);
    }
    return 1;
}



Re: Brief help please! - Andregood - 19.04.2011

Thanks, it works and all, albeit, is there anyway to change it that when I do /setrace I start gaining HP instantly? As this merely gives HP on player spawn basically.


Thanks!