111 lines
3.3 KiB
SourcePawn
111 lines
3.3 KiB
SourcePawn
#include <sourcemod>
|
|
#include <BotTargeting>
|
|
#include <cstrike>
|
|
#include <mapchooser_extended>
|
|
|
|
bool g_bDoingMapTouristMode;
|
|
|
|
public Plugin myinfo =
|
|
{
|
|
name = "knockback low pop modifier",
|
|
author = "jenz",
|
|
description = "balances knockback for low population",
|
|
version = "1.0.0",
|
|
url = ""
|
|
}
|
|
|
|
public void OnPluginStart()
|
|
{
|
|
HookEvent("round_start", OnRoundStart);
|
|
g_bDoingMapTouristMode = false;
|
|
}
|
|
|
|
public void OnPluginEnd()
|
|
{
|
|
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
|
g_bDoingMapTouristMode = false;
|
|
}
|
|
|
|
public void OnMapEnd()
|
|
{
|
|
g_bDoingMapTouristMode = false;
|
|
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
|
}
|
|
|
|
public void OnMapStart()
|
|
{
|
|
char map[PLATFORM_MAX_PATH];
|
|
GetCurrentMap(map, PLATFORM_MAX_PATH);
|
|
|
|
//skipping de_, cs_, zm_ maps
|
|
if (StrContains(map, "ze_") == 0)
|
|
{
|
|
//Decided for now to exclude MaxPlayers
|
|
//MaxTime, MinTime, MinPlayers, CooldownTime, MinHoursAvg
|
|
if (GetMapMaxTime(map) != 0 || GetMapMinTime(map) != 0 || GetMapMinPlayers(map) != 0 /*|| GetMapMaxPlayers(map) != 0*/ || GetMapCooldownTime(map) > 60
|
|
|| GetMapMinHoursAvg(map) != 0)
|
|
{
|
|
g_bDoingMapTouristMode = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
|
{
|
|
int active_player_count = 0;
|
|
|
|
for (int i = 1; i <= MaxClients; i++)
|
|
{
|
|
if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && !IsFakeClient(i) && !IsClientAutismBot(i) && !IsClientSourceTV(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR)
|
|
{
|
|
active_player_count++;
|
|
}
|
|
}
|
|
|
|
if (active_player_count < 24)
|
|
{
|
|
int zombie_ratio = GetConVarInt(FindConVar("zr_infect_mzombie_ratio"));
|
|
|
|
float knockback_increase = float(zombie_ratio) / float(active_player_count);
|
|
|
|
if (knockback_increase > 3.0)
|
|
knockback_increase = 3.0;
|
|
else if(knockback_increase < 1.0)
|
|
knockback_increase = 1.0
|
|
|
|
if (knockback_increase > 1.0 || (g_bDoingMapTouristMode && active_player_count < 18))
|
|
{
|
|
if (g_bDoingMapTouristMode)
|
|
{
|
|
CreateTimer(3.0, SetHealthOnCT);
|
|
}
|
|
else
|
|
{
|
|
PrintToChatAll("LOW POP: increased zombie knockback to X%.2f to balance gameplay", knockback_increase);
|
|
PrintToChatAll("LOW POP: increased zombie knockback to X%.2f to balance gameplay", knockback_increase);
|
|
PrintToChatAll("LOW POP: increased zombie knockback to X%.2f to balance gameplay", knockback_increase);
|
|
}
|
|
}
|
|
if (!g_bDoingMapTouristMode)
|
|
{
|
|
ServerCommand("zr_class_set_multiplier zombies knockback %.2f", knockback_increase);
|
|
}
|
|
ServerCommand("sm_iammo @all 0");
|
|
}
|
|
else
|
|
{
|
|
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
|
ServerCommand("sm_iammo @all 0");
|
|
}
|
|
}
|
|
|
|
public Action SetHealthOnCT(Handle timer)
|
|
{
|
|
PrintToChatAll("LOW POP ON DIFFICULT MAP: ENABLING INFINITE AMMO AND 500 HP FOR CT");
|
|
PrintToChatAll("LOW POP ON DIFFICULT MAP: ENABLING INFINITE AMMO AND 500 HP FOR CT");
|
|
PrintToChatAll("LOW POP ON DIFFICULT MAP: ENABLING INFINITE AMMO AND 500 HP FOR CT");
|
|
ServerCommand("sm_iammo @all 1");
|
|
ServerCommand("sm_hp @ct 500");
|
|
return Plugin_Handled;
|
|
}
|