SA-MP Forums Archive
Ten Second Invincibility - 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: Ten Second Invincibility (/showthread.php?tid=261286)



Ten Second Invincibility - Jack_Rocker - 12.06.2011

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

Jack_Rocker


Re: Ten Second Invincibility - Markx - 12.06.2011

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;
}



Re: Ten Second Invincibility - Jack_Rocker - 12.06.2011

thanks dude


Re: Ten Second Invincibility - DRIFT_HUNTER - 12.06.2011

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