AN: major update

FK: minor fixes
This commit is contained in:
dogan 2020-07-21 00:29:03 +02:00
parent eb97a21c78
commit 74ce2cc2b1
2 changed files with 132 additions and 21 deletions

View File

@ -5,6 +5,7 @@
#include <zombiereloaded>
#include <cstrike>
#include <multicolors>
#include <PlayerManager>
int g_iHighRatio;
int g_iMediumRatio;
@ -37,6 +38,11 @@ float g_fKnockbackMidRoundBoost;
float g_fNapalmMidRoundReduction;
float g_fMidRoundRatio;
bool g_bNoSteam;
float g_fKnockbackNoSteamBoost;
float g_fNapalmNoSteamReduction;
float g_fNoSteamRatio;
bool g_bAntiNoob;
float g_fCurrentKnockbackBoost;
float g_fCurrentNapalmDamage;
@ -46,7 +52,7 @@ public Plugin myinfo =
name = "AntiNoob",
author = "Dogan",
description = "Provide help when the server is doing bad on a map",
version = "4.0.0",
version = "5.0.0",
url = ""
}
@ -91,12 +97,18 @@ public void OnPluginStart()
g_fNapalmMediumReduction = cvar.FloatValue;
HookConVarChange((cvar = CreateConVar("sm_an_napalm_highhelp", "6.0", "napalm damage reduction needed when high help is perfomed for full burn from nades (stacking)")), g_cvNapalmHighReduction);
g_fNapalmHighReduction = cvar.FloatValue;
HookConVarChange((cvar = CreateConVar("sm_an_napalm_midround", "2.0", "napalm damage reduction needed when mid round help is performed for full burn from nades (stacking)")), g_cvNapalmMidRoundReduction);
HookConVarChange((cvar = CreateConVar("sm_an_napalm_midround", "1.0", "napalm damage reduction needed when mid round help is performed for full burn from nades (stacking)")), g_cvNapalmMidRoundReduction);
g_fNapalmMidRoundReduction = cvar.FloatValue;
HookConVarChange((cvar = CreateConVar("sm_an_kb_midround", "5.0", "knockback boost in procent when mid round help is performed (stacking)")), g_cvKnockbackMidRoundBoost);
HookConVarChange((cvar = CreateConVar("sm_an_kb_midround", "2.5", "knockback boost in procent when mid round help is performed (stacking)")), g_cvKnockbackMidRoundBoost);
g_fKnockbackMidRoundBoost = cvar.FloatValue / 100.0;
HookConVarChange((cvar = CreateConVar("sm_an_midroundratio", "1.011", "human:zombie amount ratio to perform mid round help, x = zombie")), g_cvMidRoundRatio);
HookConVarChange((cvar = CreateConVar("sm_an_midroundratio", "1.20", "zombie ratio in relation to humans to perform mid round help")), g_cvMidRoundRatio);
g_fMidRoundRatio = cvar.FloatValue;
HookConVarChange((cvar = CreateConVar("sm_an_napalm_nosteam", "1.0", "napalm damage reduction needed when nosteam help is performed for full burn from nades (stacking)")), g_cvNapalmNoSteamReduction);
g_fNapalmNoSteamReduction = cvar.FloatValue;
HookConVarChange((cvar = CreateConVar("sm_an_kb_nosteam", "2.5", "knockback boost in procent when nosteam help is performed (stacking)")), g_cvKnockbackNoSteamBoost);
g_fKnockbackNoSteamBoost = cvar.FloatValue / 100.0;
HookConVarChange((cvar = CreateConVar("sm_an_nosteamratio", "0.25", "nosteam ratio in relation to server population to perform nosteam help")), g_cvNoSteamRatio);
g_fNoSteamRatio = cvar.FloatValue;
delete cvar;
RegAdminCmd("sm_antinoob", Command_AntiNoob, ADMFLAG_GENERIC, "returns the current helps or boosts for this round");
@ -205,6 +217,21 @@ public void g_cvMidRoundRatio(ConVar convar, const char[] oldValue, const char[]
g_fMidRoundRatio = convar.FloatValue;
}
public void g_cvNapalmNoSteamReduction(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_fNapalmNoSteamReduction = convar.FloatValue;
}
public void g_cvKnockbackNoSteamBoost(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_fKnockbackNoSteamBoost = convar.FloatValue / 100.0;
}
public void g_cvNoSteamRatio(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_fNoSteamRatio = convar.FloatValue;
}
public void OnMapStart()
{
g_iHumanScore = 1;
@ -225,6 +252,12 @@ public Action Command_AntiNoob(int client, int args)
Format(cAdminNotification, sizeof(cAdminNotification), "{cyan}[AntiNoob]{white} Currently boosting knockback by {red}%.2f%%{white}.", ((g_fCurrentKnockbackBoost - 1.0) * 100.0));
if(g_bLowPopulation)
CPrintToChat(client, "{cyan}[AntiNoob]{white} Low Population detected.");
if(g_bNoSteam)
CPrintToChat(client, "{cyan}[AntiNoob]{white} Large Amount of No-Steam Players detected.");
CPrintToChat(client, "%s", cAdminNotification);
return Plugin_Handled;
@ -276,13 +309,10 @@ public void CheckHumanZombieCount()
ServerCommand("zr_class_set_multiplier zombies knockback %f", g_fCurrentKnockbackBoost);
ServerCommand("zr_napalm_time_scale %f", g_fCurrentNapalmDamage);
char cAdminNotification[256];
Format(cAdminNotification, sizeof(cAdminNotification), "{cyan}[AntiNoob]{white} Adding an additional {red}%.2f%%{white} mid round knockback boost because the Human:Zombie Ratio exceeded {red}1:%.2f{white}.", g_fKnockbackMidRoundBoost * 100.0, g_fMidRoundRatio);
for(int i = 1; i <= MaxClients; i++)
{
if(IsAdmin(i))
CPrintToChat(i,"%s", cAdminNotification);
CPrintToChat(i, "{cyan}[AntiNoob]{white} Large Amount of Zombies detected.");
}
}
}
@ -295,9 +325,7 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
g_bMidRound = false;
if(g_iHumanScore == 0)
{
g_iHumanScore = 1;
}
if(g_iZombieScore != g_iOldZombieScore)
{
@ -310,13 +338,25 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
}
int iActivePlayers;
int iActiveSteamPlayers;
int iActiveNoSteamPlayers;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) >= CS_TEAM_T)
iActivePlayers++;
if(!IsClientInGame(i) || IsFakeClient(i) || GetClientTeam(i) <= CS_TEAM_T)
continue;
iActivePlayers++;
if(PM_IsPlayerSteam(i))
iActiveSteamPlayers++;
else
iActiveNoSteamPlayers++;
}
if(iActiveSteamPlayers == 0)
iActiveSteamPlayers = 1;
char cAdminNotification[128] = "{cyan}[AntiNoob]{white} Currently disabled.";
if(!g_bAntiNoob)
@ -337,6 +377,11 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
else
g_bLowPopulation = false;
if((float(iActiveNoSteamPlayers) / float(iActiveSteamPlayers)) >= g_fNoSteamRatio)
g_bNoSteam = true;
else
g_bNoSteam = false;
if(g_iZombieScore / g_iHumanScore >= g_iHighRatio || g_iZombieStreak >= g_iHighStreak)
PerformHighHelp();
else if(g_iZombieScore / g_iHumanScore >= g_iMediumRatio || g_iZombieStreak >= g_iMediumStreak)
@ -350,20 +395,45 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
for(int i = 1; i <= MaxClients; i++)
{
if(IsAdmin(i))
CPrintToChat(i,"%s", cAdminNotification);
if(!IsAdmin(i))
continue;
if(g_bLowPopulation)
CPrintToChat(i, "{cyan}[AntiNoob]{white} Low Population detected.");
if(g_bNoSteam)
CPrintToChat(i, "{cyan}[AntiNoob]{white} Large Amount of No-Steam Players detected.");
if(g_bMidRound)
CPrintToChat(i, "{cyan}[AntiNoob]{white} Large Amount of Zombies detected.");
CPrintToChat(i,"%s", cAdminNotification);
}
}
public void PerformHighHelp()
{
if(g_bLowPopulation)
if(g_bNoSteam && g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackHighBoost + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmHighReduction - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackHighBoost + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmHighReduction - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction;
}
else if(g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackHighBoost + g_fKnockbackPopulationBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmHighReduction - g_fNapalmPopulationReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackHighBoost + g_fKnockbackPopulationBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmHighReduction - g_fNapalmPopulationReduction;
}
else if(g_bNoSteam)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackHighBoost + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmHighReduction - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackHighBoost + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmHighReduction - g_fNapalmNoSteamReduction;
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackHighBoost);
@ -375,13 +445,27 @@ public void PerformHighHelp()
public void PerformMediumHelp()
{
if(g_bLowPopulation)
if(g_bNoSteam && g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackMediumBoost + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmMediumReduction - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackMediumBoost + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmMediumReduction - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction;
}
else if(g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackMediumBoost + g_fKnockbackPopulationBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmMediumReduction - g_fNapalmPopulationReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackMediumBoost + g_fKnockbackPopulationBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmMediumReduction - g_fNapalmPopulationReduction;
}
else if(g_bNoSteam)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackMediumBoost + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmMediumReduction - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackMediumBoost + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmMediumReduction - g_fNapalmNoSteamReduction;
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackMediumBoost);
@ -393,13 +477,27 @@ public void PerformMediumHelp()
public void PerformLowHelp()
{
if(g_bLowPopulation)
if(g_bNoSteam && g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackLowBoost + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmLowReduction - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackLowBoost + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmLowReduction - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction;
}
else if(g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackLowBoost + g_fKnockbackPopulationBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmLowReduction - g_fNapalmPopulationReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackLowBoost + g_fKnockbackPopulationBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmLowReduction - g_fNapalmPopulationReduction;
}
else if(g_bNoSteam)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackLowBoost + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmLowReduction - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackLowBoost + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmLowReduction - g_fNapalmNoSteamReduction;
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackLowBoost);
@ -408,16 +506,29 @@ public void PerformLowHelp()
g_fCurrentNapalmDamage = 50.0 - g_fNapalmLowReduction;
}
}
public void PerformReset()
{
if(g_bLowPopulation && g_bAntiNoob)
if(g_bLowPopulation && g_bNoSteam && g_bAntiNoob)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackPopulationBoost + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmPopulationReduction - g_fNapalmNoSteamReduction;
}
else if(g_bLowPopulation && g_bAntiNoob)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackPopulationBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmPopulationReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackPopulationBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmPopulationReduction;
}
else if(g_bNoSteam && g_bAntiNoob)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackNoSteamBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmNoSteamReduction);
g_fCurrentKnockbackBoost = 1.0 + g_fKnockbackNoSteamBoost;
g_fCurrentNapalmDamage = 50.0 - g_fNapalmNoSteamReduction;
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");

View File

@ -229,7 +229,7 @@ public Action Command_DebugFakes(int client, int argc)
//----------------------------------------------------------------------------------------------------
public Action Command_SetFakes(int client, int argc)
{
if(g_iBlockInstantFakeConnects <= 5)
if(g_iBlockInstantFakeConnects <= 6)
{
ReplyToCommand(client, "[SM] Not available right now, because the Plugin is still loading. Try again in couple seconds.");
return Plugin_Handled;
@ -434,7 +434,7 @@ public void CheckPopulation()
//CS_SetClientClanTag(iIndex, "UNLOZE");
iFakes++;
if(g_iBlockInstantFakeConnects <= 6)
if(g_iBlockInstantFakeConnects <= 6 && g_iAdminFakes == -1)
g_bBlockInstantFakeConnects = true;
}