General: Allow auto infection on 'late' spawners.

Catch people that automatically spawn after motherzombie infection, and
make them spawn as zombies. On CSS for example you automatically spawn
if you spawn between round start and 20 seconds after, thus avoiding the
need of zspawn.
This commit is contained in:
zaCade 2018-08-23 20:07:40 +02:00
parent ced7d3c352
commit a45be16399
2 changed files with 30 additions and 7 deletions

View File

@ -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.");

View File

@ -275,15 +275,36 @@ InfectOnClientTeam(client, team)
*/
InfectOnClientSpawn(client)
{
// If the zombie has spawned.
if (InfectHasZombieSpawned())
{
// 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;
// Check if client is spawning on the terrorist team.
if (ZRIsClientOnTeam(client, CS_TEAM_T) && InfectHasZombieSpawned())
// Swap the client to counter-terrorists.
if (ZRIsClientOnTeam(client, CS_TEAM_T))
{
CS_SwitchTeam(client, CS_TEAM_CT);
CS_RespawnPlayer(client);
}
}
}
InfectUnglitchKevlar(client);
}