AN: switch from round start to zombies spawned

much better since lots of ppl join afterwards which messes up the calculation
This commit is contained in:
dogan 2020-07-21 02:15:28 +02:00
parent 3c7ebff11f
commit 164a81d17c

View File

@ -44,6 +44,7 @@ float g_fNapalmNoSteamReduction;
float g_fNoSteamRatio; float g_fNoSteamRatio;
bool g_bAntiNoob; bool g_bAntiNoob;
bool g_bZombiesSpawned;
float g_fCurrentKnockbackBoost; float g_fCurrentKnockbackBoost;
float g_fCurrentNapalmDamage; float g_fCurrentNapalmDamage;
@ -58,7 +59,7 @@ public Plugin myinfo =
public void OnPluginStart() public void OnPluginStart()
{ {
HookEvent("round_start", OnRoundStart); HookEvent("round_end", OnRoundEnd);
HookEvent("player_team", OnPlayerTeam); HookEvent("player_team", OnPlayerTeam);
g_fCurrentKnockbackBoost = 1.0; g_fCurrentKnockbackBoost = 1.0;
@ -250,6 +251,14 @@ public Action Command_AntiNoob(int client, int args)
return Plugin_Handled; return Plugin_Handled;
} }
Format(cAdminNotification, sizeof(cAdminNotification), "{cyan}[AntiNoob]{white} Waiting for Zombies to spawn before doing anything!");
if(!g_bZombiesSpawned)
{
CPrintToChat(client, "%s", cAdminNotification);
return Plugin_Handled;
}
Format(cAdminNotification, sizeof(cAdminNotification), "{cyan}[AntiNoob]{white} Currently boosting knockback by {red}%.2f%%{white}.", ((g_fCurrentKnockbackBoost - 1.0) * 100.0)); Format(cAdminNotification, sizeof(cAdminNotification), "{cyan}[AntiNoob]{white} Currently boosting knockback by {red}%.2f%%{white}.", ((g_fCurrentKnockbackBoost - 1.0) * 100.0));
if(g_bLowPopulation) if(g_bLowPopulation)
@ -320,13 +329,29 @@ public void CheckHumanZombieCount()
} }
} }
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
{
if(!g_bZombiesSpawned && motherInfect)
{
g_bZombiesSpawned = true;
StartRoundCheck();
}
}
public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
g_bZombiesSpawned = false;
g_bMidRound = false;
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
ServerCommand("zr_napalm_time_scale 50.0");
}
public void StartRoundCheck()
{ {
g_iHumanScore = GetTeamScore(CS_TEAM_CT); g_iHumanScore = GetTeamScore(CS_TEAM_CT);
g_iZombieScore = GetTeamScore(CS_TEAM_T); g_iZombieScore = GetTeamScore(CS_TEAM_T);
g_bMidRound = false;
if(g_iHumanScore == 0) if(g_iHumanScore == 0)
g_iHumanScore = 1; g_iHumanScore = 1;