#pragma tabsize 4 #include //Change this, it's the seconds you are protected for #define SPAWN_PROTECTION_TIME 8 new bool:JustSpawned[MAX_PLAYERS]; new SpawnCounter[MAX_PLAYERS]; new gPlayerCount; new SpawnTimer; forward OnFilterScriptInit(); forward OnFilterScriptExit(); forward OnPlayerConnect(playerid); forward OnPlayerDisconnect(playerid); forward OnPlayerSpawn(playerid); forward OnPlayerDeath(playerid, killerid, reason); forward ProtectTheSpawns(); public OnFilterScriptInit() { print("\n----------------------------------"); print(" Spawn System Initiation Complete"); print("----------------------------------\n"); } public OnFilterScriptExit() { print("\n----------------------------------"); print(" Spawn System Exit Complete "); print("----------------------------------\n"); } public OnPlayerConnect(playerid) { if (gPlayerCount == 0) { SpawnTimer = SetTimer("ProtectTheSpawns", 999, 1); printf("gPlayerCount = %d\nProtectTheSpawns Timer Init", gPlayerCount); } gPlayerCount++; } public OnPlayerDisconnect(playerid) { gPlayerCount--; if (gPlayerCount == 0) { KillTimer(SpawnTimer); printf("gPlayerCount = %d\nProtectTheSpawns Timer Exit", gPlayerCount); } } public OnPlayerSpawn(playerid) { JustSpawned[playerid] = true; SpawnCounter[playerid] = 0; } public ProtectTheSpawns() { for (new i; i