diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 17da431..51a34fa 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -107,6 +107,7 @@ enum CvarsList Handle:CVAR_INFECT_WEAPONS_DROP, Handle:CVAR_INFECT_KNIFE_COOLDOWN, Handle:CVAR_INFECT_MAX_DISTANCE, + Handle:CVAR_INFECT_LATE_SPAWN, Handle:CVAR_INFECT_MZOMBIE_MODE, Handle:CVAR_INFECT_MZOMBIE_RATIO, Handle:CVAR_INFECT_MZOMBIE_MIN, @@ -335,6 +336,7 @@ CvarsCreate() g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "Force player to drop all weapons on infect, disabling this will strip weapons instead."); g_hCvarsList[CVAR_INFECT_KNIFE_COOLDOWN] = CreateConVar("zr_infect_knife_cooldown", "1.0", "Time in seconds during which knife can not be used after becoming a zombie."); g_hCvarsList[CVAR_INFECT_MAX_DISTANCE] = CreateConVar("zr_infect_max_distance", "80.0", "The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]"); + g_hCvarsList[CVAR_INFECT_LATE_SPAWN] = CreateConVar("zr_infect_late_spawn", "0", "Should people spawning after mother infection also be infected, or should nothing happen. [0.0 = Disabled]"); // Effects g_hCvarsList[CVAR_INFECT_EXPLOSION] = CreateConVar("zr_infect_explosion", "1", "Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way."); diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 970a9c0..f4a6f81 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -275,14 +275,35 @@ InfectOnClientTeam(client, team) */ InfectOnClientSpawn(client) { - // Disable zombie flag on client. - g_bZombie[client] = false; - - // Check if client is spawning on the terrorist team. - if (ZRIsClientOnTeam(client, CS_TEAM_T) && InfectHasZombieSpawned()) + // If the zombie has spawned. + if (InfectHasZombieSpawned()) { - CS_SwitchTeam(client, CS_TEAM_CT); - CS_RespawnPlayer(client); + // Check if late spawn protection is enabled. + new bool:latespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_LATE_SPAWN]); + if (latespawn) + { + // Enable zombie flag on client. + g_bZombie[client] = true; + + // Swap the client to terrorists. + if (ZRIsClientOnTeam(client, CS_TEAM_CT)) + { + CS_SwitchTeam(client, CS_TEAM_T); + CS_RespawnPlayer(client); + } + } + else + { + // Disable zombie flag on client. + g_bZombie[client] = false; + + // Swap the client to counter-terrorists. + if (ZRIsClientOnTeam(client, CS_TEAM_T)) + { + CS_SwitchTeam(client, CS_TEAM_CT); + CS_RespawnPlayer(client); + } + } } InfectUnglitchKevlar(client);