From f9aaf9758040357070f15b0d52afd89a1baf2a98 Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Sun, 22 Mar 2015 19:09:49 +0100 Subject: [PATCH] Extract function ZTeleGetClientDelay. --- src/zr/ztele.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/zr/ztele.inc b/src/zr/ztele.inc index 9f22f5f..1b91df5 100644 --- a/src/zr/ztele.inc +++ b/src/zr/ztele.inc @@ -176,7 +176,7 @@ bool:ZTeleClient(client, bool:force = false) GetClientAbsOrigin(client, g_vecZTeleOrigin[client]); // Set timeleft array to value of respective cvar. - g_iZTeleTimeLeft[client] = infected ? GetConVarInt(g_hCvarsList[CVAR_ZTELE_DELAY_ZOMBIE]) : GetConVarInt(g_hCvarsList[CVAR_ZTELE_DELAY_HUMAN]); + g_iZTeleTimeLeft[client] = ZTeleGetClientDelay(client); if (g_iZTeleTimeLeft[client] > 0) { // Tell client how much time is left until teleport. @@ -493,3 +493,18 @@ bool ZTeleHasReachedLimit(int client) int maxTeleports = ZTeleGetClientLimit(client); return teleportCount >= maxTeleports; } + +int ZTeleGetZombieDelay() +{ + return GetConVarInt(g_hCvarsList[CVAR_ZTELE_DELAY_ZOMBIE]); +} + +int ZTeleGetHumanDelay() +{ + return GetConVarInt(g_hCvarsList[CVAR_ZTELE_DELAY_HUMAN]); +} + +int ZTeleGetClientDelay(int client) +{ + InfectIsClientInfected(client) ? ZTeleGetZombieDelay() : ZTeleGetHumanDelay(); +}