New Plugins from Secrets

AntiNoob + FakePopulation
This commit is contained in:
DoganGFL 2019-07-25 00:28:59 +02:00
parent a252fe8fcc
commit 9073c3f590
2 changed files with 291 additions and 0 deletions

View File

@ -0,0 +1,199 @@
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <zombiereloaded>
#include <cstrike>
int g_iHighRatio;
int g_iMediumRatio;
int g_iLowRatio;
int g_iHighStreak;
int g_iMediumStreak;
int g_iLowStreak;
int g_iHumanScore;
int g_iZombieScore;
int g_iOldZombieScore;
int g_iZombieStreak;
bool g_bLowPopulation;
int g_iMaxPopulation;
float g_fKnockbackBoost;
ConVar g_cvNapalmScale;
float g_fNapalmScale;
public Plugin myinfo =
{
name = "AntiNoob",
author = "Dogan",
description = "Provide help when the server is doing bad on a map",
version = "2.0.0",
url = ""
}
public void OnPluginStart()
{
g_iHighRatio = 7;
g_iMediumRatio = 5;
g_iLowRatio = 3;
g_iHighStreak = 6;
g_iMediumStreak = 4;
g_iLowStreak = 2;
HookEvent("round_start", OnRoundStart);
ConVar cvar;
HookConVarChange((cvar = CreateConVar("sm_an_maxplayers", "40", "max active players until the kb should be increased")), g_cvMaxPopulation);
g_iMaxPopulation = cvar.IntValue;
HookConVarChange((cvar = CreateConVar("sm_an_kb", "5.0", "knockback boost during low population in procent")), g_cvKnockbackBoost);
g_fKnockbackBoost = cvar.FloatValue / 100.0;
delete cvar;
AutoExecConfig(true, "plugin.AntiNoob");
}
public void g_cvMaxPopulation(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_iMaxPopulation = convar.IntValue;
}
public void g_cvKnockbackBoost(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_fKnockbackBoost = convar.FloatValue / 100.0;
}
public void OnAllPluginsLoaded()
{
g_cvNapalmScale = FindConVar("zr_napalm_time_scale");
}
public void OnMapStart()
{
g_iHumanScore = 1;
g_iZombieScore = 0;
g_iOldZombieScore = 0;
g_iZombieStreak = 0;
}
public void OnConfigsExecuted()
{
g_fNapalmScale = g_cvNapalmScale.FloatValue;
}
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
g_iHumanScore = GetTeamScore(CS_TEAM_CT);
g_iZombieScore = GetTeamScore(CS_TEAM_T);
if(g_iHumanScore == 0)
{
g_iHumanScore = 1;
}
if(g_iZombieScore != g_iOldZombieScore)
{
g_iZombieStreak++;
g_iOldZombieScore++;
}
else
{
g_iZombieStreak = 0;
}
int ActivePlayers;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) != CS_TEAM_SPECTATOR)
{
ActivePlayers++;
}
}
if(ActivePlayers <= g_iMaxPopulation)
{
g_bLowPopulation = true;
}
else
{
g_bLowPopulation = 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)
{
PerformMediumHelp();
}
else if(g_iZombieScore / g_iHumanScore >= g_iLowRatio || g_iZombieStreak >= g_iLowStreak)
{
PerformLowHelp();
}
else
{
PerformReset();
}
}
public void PerformHighHelp()
{
if(g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.15 + g_fKnockbackBoost);
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale - 8.0);
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback 1.15");
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale - 6.0);
}
}
public void PerformMediumHelp()
{
if(g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.1 + g_fKnockbackBoost);
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale - 6.0);
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback 1.1");
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale - 4.0);
}
}
public void PerformLowHelp()
{
if(g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.05 + g_fKnockbackBoost);
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale - 4.0);
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback 1.05");
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale - 2.0);
}
}
public void PerformReset()
{
if(g_bLowPopulation)
{
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackBoost);
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale - 2.0);
}
else
{
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
ServerCommand("zr_napalm_time_scale %f", g_fNapalmScale);
}
}

View File

@ -0,0 +1,92 @@
#include <sourcemod>
#include <A2SFixes>
#pragma semicolon 1
#pragma newdecls required
int g_iFakePlayers = 0;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "ImprovedHitboxes", //camouflage
author = "Neon",
description = "",
version = "1.0",
url = "https://steamcommunity.com/id/n3ontm"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
RegAdminCmd("sm_debugfakes", Command_DebugFakes, ADMFLAG_RCON, "");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginEnd()
{
FakePlayers(0);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Command_DebugFakes(int client, int argc)
{
ReplyToCommand(client, "[SM] There are currently %d Fake Players.", g_iFakePlayers);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientConnected(int client)
{
CheckPopulation();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientDisconnect(int client)
{
CheckPopulation();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void CheckPopulation()
{
int iPlayers = 0;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && !IsFakeClient(i))
iPlayers++;
}
if (iPlayers > 61)
g_iFakePlayers = 0;
else if(iPlayers > 60)
g_iFakePlayers = 1;
else if(iPlayers > 55)
g_iFakePlayers = 3;
else if (iPlayers > 40)
g_iFakePlayers = 4;
else if (iPlayers > 20)
g_iFakePlayers = 3;
else if (iPlayers > 10)
g_iFakePlayers = 2;
else if (iPlayers > 5)
g_iFakePlayers = 1;
else
g_iFakePlayers = 0;
FakePlayers(g_iFakePlayers);
}