12.06.2011, 19:59
How can I make it so that when a player spawns they have 10 seconds of invincibility?
Jack_Rocker
Jack_Rocker
//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;
}
pawn Код:
|