forked from UNLOZE/sm-plugins
majorly redid fakeclients behaviour to be balanced, updated knockback modifier to only consider mapcooldowns of over 60 hours and to check the timeleft on maps to prevent triggering the condition hopefully too early
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include <sourcemod>
|
||||
#include <BotTargeting>
|
||||
#include <cstrike>
|
||||
#include <mapchooser_extended>
|
||||
|
||||
@@ -10,7 +9,7 @@ public Plugin myinfo =
|
||||
name = "knockback low pop modifier",
|
||||
author = "jenz",
|
||||
description = "balances knockback for low population",
|
||||
version = "1.0.0",
|
||||
version = "1.1.0",
|
||||
url = ""
|
||||
}
|
||||
|
||||
@@ -42,7 +41,7 @@ public void OnMapStart()
|
||||
{
|
||||
//Decided for now to exclude MaxPlayers
|
||||
//MaxTime, MinTime, MinPlayers, CooldownTime, MinHoursAvg
|
||||
if (GetMapMaxTime(map) != 0 || GetMapMinTime(map) != 0 || GetMapMinPlayers(map) != 0 /*|| GetMapMaxPlayers(map) != 0*/ || GetMapCooldownTime2(map) > 60
|
||||
if (GetMapMaxTime(map) != 0 || GetMapMinTime(map) != 0 || GetMapMinPlayers(map) != 0 || GetMapCooldownTime2(map) > 60
|
||||
|| GetMapMinHoursAvg(map) != 0)
|
||||
{
|
||||
g_bDoingMapTouristMode = true;
|
||||
@@ -52,56 +51,55 @@ public void OnMapStart()
|
||||
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
if (CS_GetTeamScore(CS_TEAM_T) == 0 && CS_GetTeamScore(CS_TEAM_CT) == 0)
|
||||
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
||||
ServerCommand("sm_iammo @all 0");
|
||||
|
||||
int TimeLeft;
|
||||
if (GetMapTimeLeft(TimeLeft) && TimeLeft < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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))
|
||||
if (IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && !IsFakeClient(i) && !IsClientSourceTV(i))
|
||||
{
|
||||
active_player_count++;
|
||||
}
|
||||
}
|
||||
|
||||
int choosen_number = 24;
|
||||
int choosen_number = 14;
|
||||
if (active_player_count < choosen_number)
|
||||
{
|
||||
int zombie_ratio = GetConVarInt(FindConVar("zr_infect_mzombie_ratio"));
|
||||
int infectectable_players = 0;
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR)
|
||||
{
|
||||
infectectable_players++;
|
||||
}
|
||||
}
|
||||
|
||||
float knockback_increase = float(zombie_ratio) / float(active_player_count);
|
||||
float knockback_increase = float(zombie_ratio) / float(infectectable_players);
|
||||
|
||||
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 < choosen_number))
|
||||
{
|
||||
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 1.0");
|
||||
if (g_bDoingMapTouristMode)
|
||||
{
|
||||
CreateTimer(3.0, SetHealthOnCT);
|
||||
}
|
||||
else if (knockback_increase > 1.0)
|
||||
{
|
||||
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);
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user