diff --git a/src/zr/api/infect.api.inc b/src/zr/api/infect.api.inc index 31ddc16..d64b9c8 100644 --- a/src/zr/api/infect.api.inc +++ b/src/zr/api/infect.api.inc @@ -28,6 +28,7 @@ /** * @section Global forward handles. */ +new Handle:g_hAPIFwdOnInfectCountdown = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientInfect = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientInfected = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientHuman = INVALID_HANDLE; @@ -51,6 +52,7 @@ APIInfectInit() CreateNative("ZR_HumanClient", APIHumanClient); // Forwards + g_hAPIFwdOnInfectCountdown = CreateGlobalForward("ZR_OnInfectCountdown", ET_Hook); g_hAPIFwdOnClientInfect = CreateGlobalForward("ZR_OnClientInfect", ET_Hook, Param_CellByRef, Param_CellByRef, Param_CellByRef, Param_CellByRef, Param_CellByRef); g_hAPIFwdOnClientInfected = CreateGlobalForward("ZR_OnClientInfected", ET_Ignore, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell); g_hAPIFwdOnClientHuman = CreateGlobalForward("ZR_OnClientHuman", ET_Hook, Param_CellByRef, Param_CellByRef, Param_CellByRef); @@ -126,6 +128,20 @@ public APIHumanClient(Handle:plugin, numParams) return InfectZombieToHuman(client, respawn, protect); } +/** + * Called on infection timer to determine if timer should show. + */ +Action:APIOnInfectCountdown() +{ + // Start forward call. + Call_StartForward(g_hAPIFwdOnInfectCountdown); + + // Get what they returned. + new Action:result; + Call_Finish(result); + return result; +} + /** * Called when a client is about to become a zombie. * diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 8c53da5..8759b49 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -694,8 +694,12 @@ public Action:InfectCountdown(Handle:timer) return Plugin_Stop; } - // Print the countdown text to the clients. - TranslationPrintCenterTextAll(false, "Infect countdown", RoundToNearest(length - counter)); + // Ask plugin API if timer should be shown. + if (APIOnInfectCountdown() == Plugin_Continue) + { + // Print the countdown text to the clients. + TranslationPrintCenterTextAll(false, "Infect countdown", RoundToNearest(length - counter)); + } counter++;