Ten Second Invincibility
#1

How can I make it so that when a player spawns they have 10 seconds of invincibility?

Jack_Rocker
Reply
#2

pawn Код:
//On top

new AntiSpawnKillProtected[MAX_PLAYERS];

forward AntiSpawnKillOff(playerid);

//Under OnPlayerSpawn
AntiSpawnKillProtected[playerid] = 1;
SetTimer("AntiSpawnKillOff", 10000, false);

// Under OnPlayerUpdate
if(AntiSpawnKillProtected[playerid] == 1)
{
    SetPlayerHealth(playerid, 1000);
}

//Somewhere in script (outside a callback)

AntiSpawnKillOff(playerid)
{
    SetPlayerHealth(playerid, 100);
    AntiSpawnKillProtected[playerid] = 0;
    SendClientMessage(playerid, -1, "Anti spawn kill is now off!");
    return true;
}
Reply
#3

thanks dude
Reply
#4

Quote:
Originally Posted by Markx
Посмотреть сообщение
pawn Код:
//On top

new AntiSpawnKillProtected[MAX_PLAYERS];

forward AntiSpawnKillOff(playerid);

//Under OnPlayerSpawn
AntiSpawnKillProtected[playerid] = 1;
SetTimer("AntiSpawnKillOff", 10000, false);

// Under OnPlayerUpdate
if(AntiSpawnKillProtected[playerid] == 1)
{
    SetPlayerHealth(playerid, 1000);
}

//Somewhere in script (outside a callback)

AntiSpawnKillOff(playerid)
{
    SetPlayerHealth(playerid, 100);
    AntiSpawnKillProtected[playerid] = 0;
    SendClientMessage(playerid, -1, "Anti spawn kill is now off!");
    return true;
}
I see at least someone is searching/reading older posts
Respect man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)