SA-MP Forums Archive
spawn protecion? - 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: spawn protecion? (/showthread.php?tid=174750)



spawn protecion? - Face9000 - 06.09.2010

Hi all,someone know a good FS spawn protection?

Example,when i spawn,i've 10 second of immortality and no one can damage me

Thanks D:


Re: spawn protecion? - Mauzen - 06.09.2010

You could set players health to 9999999.9 on spawn and set a timer to set it back to 100


Re: spawn protecion? - Vince - 06.09.2010

pawn Код:
#define FLOAT_INFINITY      (Float:0x7F800000)

forward Godmode(playerid, bool:enable);

public Godmode(playerid, bool:enable)
{
    if(enable == true)
    {
        SetPlayerHealth(playerid, FLOAT_INFINITY);
    }
    else
    {
        SetPlayerHealth(playerid, 100.0);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    Godmode(playerid, true);
    SetTimerEx("Godmode", 10000, false, "ii", playerid, false);
}
Not tested.


Re: spawn protecion? - [XST]O_x - 06.09.2010

@Vince- A minor correction, as for Boolean parameters, the placeholder must be 'b' and not 'i' as 'i' stands for an integer.
So,just a minor fix:
pawn Код:
SetTimerEx("Godmode", 10000, false, "ib", playerid, false);



Re: spawn protecion? - Relixious - 06.09.2010

-nevermind-


Re: spawn protecion? - Vince - 06.09.2010

Uh, yes. It's meant to be like that.
The timer only runs once, and you can't die in those ten seconds either.


Re: spawn protecion? - Relixious - 06.09.2010

Quote:
Originally Posted by Vince
Посмотреть сообщение
Uh, yes. It's meant to be like that.
The timer only runs once, and you can't die in those ten seconds either.
Yes, i red it too fast so i thought the timer had no end