ZombieManager: 5 seconds timer for the message

This commit is contained in:
dogan 2020-08-06 23:56:06 +02:00
parent 386c806052
commit 4a32c8f52a

View File

@ -40,6 +40,7 @@ public void OnPluginStart()
RegAdminCmd("sm_shield", Command_ZShield, ADMFLAG_GENERIC, "Toggle to enable/disable zombie shield.");
CreateTimer(20.0, Timer_MessageTestRound, _, TIMER_REPEAT);
CreateTimer(5.0, Timer_UpdateHintMessage, _, TIMER_REPEAT);
CreateTimer(0.2, Timer_HandleHPShield, _, TIMER_REPEAT); // health_regen_interval = 0.2
HookEvent("round_start", OnRoundStart);
@ -462,22 +463,28 @@ public Action Timer_HandleHPShield(Handle timer)
//g_iZShield[i] = g_iZShield[i] + 12; // health_regen_amount = 12
else if(GetClientHealth(i) >= g_iZHPMax[i] && !bNemesis)
g_iZShield[i] = g_iZShield[i] + 6; // health_regen_amount = 6
UpdateHintMessage(i, bHasItem);
}
return Plugin_Continue;
}
public void UpdateHintMessage(int client, bool bHasItem)
public Action Timer_UpdateHintMessage(Handle timer)
{
bool bVote = IsVoteInProgress();
for(int i = 1; i <= MaxClients; i++)
{
if(!IsClientInGame(i) || !IsPlayerAlive(i) || !ZR_IsClientZombie(i))
continue;
if(g_bZHP[client] || bVote)
return;
bool bVote = IsVoteInProgress();
if(g_iZShield[client] <= 0 || bHasItem)
PrintHintText(client, "HP: %d", GetClientHealth(client));
else
PrintHintText(client, "HP: %d - Shield: %d", GetClientHealth(client), g_iZShield[client]);
if(g_bZHP[i] || bVote)
continue;
if(g_iZShield[i] <= 0)
PrintHintText(i, "HP: %d", GetClientHealth(i));
else
PrintHintText(i, "HP: %d - Shield: %d", GetClientHealth(i), g_iZShield[i]);
}
return Plugin_Continue;
}