diff --git a/src/include/zr/infect.zr.inc b/src/include/zr/infect.zr.inc index 2f74d8f..93550a7 100644 --- a/src/include/zr/infect.zr.inc +++ b/src/include/zr/infect.zr.inc @@ -121,3 +121,13 @@ forward Action ZR_OnClientHuman(int &client, bool &respawn, bool &protect); * @param protect Whether the client has spawn protection. */ forward void ZR_OnClientHumanPost(int client, bool respawn, bool protect); + +/** + * Called in ZRCreateEligibleClientList to determine if a client is eligible to become infected. + * + * @param client The client index. + * + * @return Plugin_Handled is not eligible. Anything else + * (like Plugin_Continue) is eligible. + */ +forward Action ZR_OnClientMotherZombieEligible(int client); diff --git a/src/zr/api/infect.api.inc b/src/zr/api/infect.api.inc index 3b2cb26..4ebc04b 100644 --- a/src/zr/api/infect.api.inc +++ b/src/zr/api/infect.api.inc @@ -32,6 +32,7 @@ new Handle:g_hAPIFwdOnClientInfect = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientInfected = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientHuman = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientHumanPost = INVALID_HANDLE; +new Handle:g_hAPIFwdOnClientMotherZombieEligible = INVALID_HANDLE; /** * @endsection */ @@ -54,6 +55,7 @@ APIInfectInit() 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); g_hAPIFwdOnClientHumanPost = CreateGlobalForward("ZR_OnClientHumanPost", ET_Ignore, Param_Cell, Param_Cell, Param_Cell); + g_hAPIFwdOnClientMotherZombieEligible = CreateGlobalForward("ZR_OnClientMotherZombieEligible", ET_Hook, Param_Cell); } /** @@ -243,3 +245,22 @@ APIOnClientHumanPost(client, bool:respawn, bool:protect) // Finish the call. Call_Finish(); } + +/** + * Called in ZRCreateEligibleClientList to determine if a client is eligible to become infected. + * + * @param client The client to check. + */ +Action:APIOnClientMotherZombieEligible(client) +{ + // Start forward call. + Call_StartForward(g_hAPIFwdOnClientMotherZombieEligible); + + // Push the parameters. + Call_PushCell(client); + + // Get what they returned. + new Action:result; + Call_Finish(result); + return result; +} diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index 1fa6a5f..46b700a 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -150,6 +150,12 @@ stock ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false continue; } + // Ask plugin API what they think about our client + if (APIOnClientMotherZombieEligible(x) == Plugin_Handled) + { + continue; + } + // Add eligible client to array. PushArrayCell(arrayEligibleClients, x); }