From fcb4fdcab6cc453c17a72f709705ef2ef64b0b3b Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Sun, 22 Mar 2015 18:21:17 +0100 Subject: [PATCH] Extract function ZTeleCanHumanTeleport. --- src/zr/ztele.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/zr/ztele.inc b/src/zr/ztele.inc index 4044184..1aa1577 100644 --- a/src/zr/ztele.inc +++ b/src/zr/ztele.inc @@ -138,10 +138,7 @@ bool:ZTeleClient(client, bool:force = false) return false; } - // If zombie has spawned, get before value, get the after value otherwise. - // If the cvar is disabled and the client is a human, then stop. - new bool:ztelehuman = InfectHasZombieSpawned() ? GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_AFTER]) : GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_BEFORE]); - if (!force && !infected && !ztelehuman) + if (!force && !infected && !ZTeleCanHumanTeleport()) { // Tell client that feature is restricted at this time. TranslationPrintToChat(client, "ZTele restricted human"); @@ -458,3 +455,10 @@ ZTeleMustBeHuman(client) return (infected && !ztelezombie); } + +ZTeleCanHumanTeleport() +{ + // There are individual restrictions whether a human can teleport before or + // after zombies have spawned. + return InfectHasZombieSpawned() ? GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_AFTER]) : GetConVarBool(g_hCvarsList[CVAR_ZTELE_HUMAN_BEFORE]); +}