diff --git a/src/zr/infect.inc b/src/zr/infect.inc index f62002e..d57406d 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -565,6 +565,16 @@ InfectClient(client, attacker = -1, bool:motherinfect = false) // TODO: A solution to stop confusing bots? Respawn and teleport? CS_SwitchTeam(client, CS_TEAM_T); + // If respawn is enabled, then teleport mother zombie back to spawnpoint. + if (motherinfect) + { + new bool:zombierespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN]); + if(zombierespawn) + { + ZTeleTeleportClient(client); + } + } + // Format infection message. SetGlobalTransTarget(client); diff --git a/src/zr/ztele.inc b/src/zr/ztele.inc index d0a8c6f..c9c860f 100644 --- a/src/zr/ztele.inc +++ b/src/zr/ztele.inc @@ -170,7 +170,7 @@ bool:ZTeleClient(client) // Tell client how much time is left until teleport. TranslationPrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]); - // Start repeating timer. + // Start timer. tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); } else @@ -178,8 +178,8 @@ bool:ZTeleClient(client) // Reset timer handle. tZTele[client] = INVALID_HANDLE; - // Teleport client. - TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR); + // Teleport client to spawn. + ZTeleTeleportClient(client); // Tell client they've been teleported. TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax); @@ -191,6 +191,17 @@ bool:ZTeleClient(client) return true; } +/** + * Teleport client to their spawn location. + * + * @param client The client index. + */ +ZTeleTeleportClient(client) +{ + // Teleport client. + TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR); +} + /** * Timer callback, counts down teleport to the client. *