Add new forward ZR_OnClientMotherZombieEligible for excluding clients from mother zombie eligible list.

This commit is contained in:
BotoX 2017-08-07 16:31:20 +02:00
parent 1e90596ddc
commit 0f6b46a962
3 changed files with 37 additions and 0 deletions

View File

@ -121,3 +121,13 @@ forward Action ZR_OnClientHuman(int &client, bool &respawn, bool &protect);
* @param protect Whether the client has spawn protection. * @param protect Whether the client has spawn protection.
*/ */
forward void ZR_OnClientHumanPost(int client, bool respawn, bool protect); 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);

View File

@ -32,6 +32,7 @@ new Handle:g_hAPIFwdOnClientInfect = INVALID_HANDLE;
new Handle:g_hAPIFwdOnClientInfected = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientInfected = INVALID_HANDLE;
new Handle:g_hAPIFwdOnClientHuman = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientHuman = INVALID_HANDLE;
new Handle:g_hAPIFwdOnClientHumanPost = INVALID_HANDLE; new Handle:g_hAPIFwdOnClientHumanPost = INVALID_HANDLE;
new Handle:g_hAPIFwdOnClientMotherZombieEligible = INVALID_HANDLE;
/** /**
* @endsection * @endsection
*/ */
@ -54,6 +55,7 @@ APIInfectInit()
g_hAPIFwdOnClientInfected = CreateGlobalForward("ZR_OnClientInfected", ET_Ignore, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell); 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_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_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. // Finish the call.
Call_Finish(); 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;
}

View File

@ -150,6 +150,12 @@ stock ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false
continue; continue;
} }
// Ask plugin API what they think about our client
if (APIOnClientMotherZombieEligible(x) == Plugin_Handled)
{
continue;
}
// Add eligible client to array. // Add eligible client to array.
PushArrayCell(arrayEligibleClients, x); PushArrayCell(arrayEligibleClients, x);
} }