spawn protecion?
#1

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:
Reply
#2

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

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.
Reply
#4

@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);
Reply
#5

-nevermind-
Reply
#6

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)