updated so that low pop helper has its own configuration now in the .cfg to decide with how many people on each map to help with easy settings
This commit is contained in:
parent
4a1ac398d0
commit
c57aa5bcc2
@ -2,32 +2,32 @@
|
|||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
#include <mapchooser_extended>
|
#include <mapchooser_extended>
|
||||||
|
|
||||||
bool g_bDoingMapTouristMode;
|
int g_iDoingMapTouristMode;
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
name = "knockback low pop modifier",
|
name = "knockback low pop modifier and helper",
|
||||||
author = "jenz",
|
author = "jenz",
|
||||||
description = "balances knockback for low population",
|
description = "balances knockback and human settings for low population",
|
||||||
version = "1.1.0",
|
version = "2.1.0",
|
||||||
url = ""
|
url = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
HookEvent("round_start", OnRoundStart);
|
HookEvent("round_start", OnRoundStart);
|
||||||
g_bDoingMapTouristMode = false;
|
g_iDoingMapTouristMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPluginEnd()
|
public void OnPluginEnd()
|
||||||
{
|
{
|
||||||
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
||||||
g_bDoingMapTouristMode = false;
|
g_iDoingMapTouristMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnMapEnd()
|
public void OnMapEnd()
|
||||||
{
|
{
|
||||||
g_bDoingMapTouristMode = false;
|
g_iDoingMapTouristMode = 0;
|
||||||
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,13 +39,8 @@ public void OnMapStart()
|
|||||||
//skipping de_, cs_, zm_ maps
|
//skipping de_, cs_, zm_ maps
|
||||||
if (StrContains(map, "ze_") == 0)
|
if (StrContains(map, "ze_") == 0)
|
||||||
{
|
{
|
||||||
//Decided for now to exclude MaxPlayers
|
//LowPopHelpCount
|
||||||
//MaxTime, MinTime, MinPlayers, CooldownTime, MinHoursAvg
|
g_iDoingMapTouristMode = GetMapLowPopHelpCount(map);
|
||||||
if (GetMapMaxTime(map) != 0 || GetMapMinTime(map) != 0 || GetMapMinPlayers(map) != 0 || GetMapCooldownTime2(map) > 60
|
|
||||||
|| GetMapMinHoursAvg(map) != 0)
|
|
||||||
{
|
|
||||||
g_bDoingMapTouristMode = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,13 +58,18 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
|||||||
int active_player_count = 0;
|
int active_player_count = 0;
|
||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
if (IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && !IsFakeClient(i) && !IsClientSourceTV(i))
|
if (IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i))
|
||||||
{
|
{
|
||||||
active_player_count++;
|
active_player_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int choosen_number = 14;
|
|
||||||
if (active_player_count < choosen_number)
|
int choosen_number = 28;
|
||||||
|
if (g_iDoingMapTouristMode > active_player_count > 0)
|
||||||
|
{
|
||||||
|
CreateTimer(3.0, SetHealthOnCT);
|
||||||
|
}
|
||||||
|
else if (active_player_count < choosen_number)
|
||||||
{
|
{
|
||||||
int zombie_ratio = GetConVarInt(FindConVar("zr_infect_mzombie_ratio"));
|
int zombie_ratio = GetConVarInt(FindConVar("zr_infect_mzombie_ratio"));
|
||||||
int infectectable_players = 0;
|
int infectectable_players = 0;
|
||||||
@ -80,20 +80,13 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
|||||||
infectectable_players++;
|
infectectable_players++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float knockback_increase = float(zombie_ratio) / float(infectectable_players);
|
float knockback_increase = float(zombie_ratio) / float(infectectable_players);
|
||||||
|
|
||||||
if (knockback_increase > 3.0)
|
if (knockback_increase > 3.0)
|
||||||
knockback_increase = 3.0;
|
knockback_increase = 3.0;
|
||||||
else if(knockback_increase < 1.0)
|
else if(knockback_increase < 1.0)
|
||||||
knockback_increase = 1.0
|
knockback_increase = 1.0
|
||||||
|
|
||||||
ServerCommand("zr_class_set_multiplier zombies knockback 1.0");
|
if (knockback_increase > 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);
|
PrintToChatAll("LOW POP: increased zombie knockback to X%.2f to balance gameplay", knockback_increase);
|
||||||
|
|||||||
@ -114,6 +114,7 @@ native bool ExcludeMapListingPriority(const char[] map, int index);
|
|||||||
native int GetMapCooldown(const char[] map);
|
native int GetMapCooldown(const char[] map);
|
||||||
native int GetMapCooldownTime(const char[] map); // in unix time
|
native int GetMapCooldownTime(const char[] map); // in unix time
|
||||||
native int GetMapCooldownTime2(const char[] map); // in unix time
|
native int GetMapCooldownTime2(const char[] map); // in unix time
|
||||||
|
native int GetMapLowPopHelpCount(const char[] map);
|
||||||
native int GetMapMinTime(const char[] map);
|
native int GetMapMinTime(const char[] map);
|
||||||
native int GetMapMaxTime(const char[] map);
|
native int GetMapMaxTime(const char[] map);
|
||||||
native int GetMapMinPlayers(const char[] map);
|
native int GetMapMinPlayers(const char[] map);
|
||||||
|
|||||||
@ -473,6 +473,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
|||||||
CreateNative("GetMapCooldown", Native_GetMapCooldown);
|
CreateNative("GetMapCooldown", Native_GetMapCooldown);
|
||||||
CreateNative("GetMapCooldownTime", Native_GetMapCooldownTime);
|
CreateNative("GetMapCooldownTime", Native_GetMapCooldownTime);
|
||||||
CreateNative("GetMapCooldownTime2", Native_GetMapCooldownTime2);
|
CreateNative("GetMapCooldownTime2", Native_GetMapCooldownTime2);
|
||||||
|
CreateNative("GetMapLowPopHelpCount", Native_GetMapLowPopHelpCount);
|
||||||
CreateNative("GetMapMinTime", Native_GetMapMinTime);
|
CreateNative("GetMapMinTime", Native_GetMapMinTime);
|
||||||
CreateNative("GetMapMaxTime", Native_GetMapMaxTime);
|
CreateNative("GetMapMaxTime", Native_GetMapMaxTime);
|
||||||
CreateNative("GetMapMinPlayers", Native_GetMapMinPlayers);
|
CreateNative("GetMapMinPlayers", Native_GetMapMinPlayers);
|
||||||
@ -2745,6 +2746,27 @@ public int Native_GetMapCooldownTime2(Handle plugin, int numParams)
|
|||||||
return InternalGetMapCooldownTime2(map);
|
return InternalGetMapCooldownTime2(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//GetMapLowPopHelpCount
|
||||||
|
public int Native_GetMapLowPopHelpCount(Handle plugin, int numParams)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
GetNativeStringLength(1, len);
|
||||||
|
|
||||||
|
if(len <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char[] map = new char[len+1];
|
||||||
|
GetNativeString(1, map, len+1);
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (g_Config && g_Config.JumpToKey(map))
|
||||||
|
{
|
||||||
|
count = g_Config.GetNum("LowPopHelpCount", count);
|
||||||
|
g_Config.Rewind();
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
public int Native_GetMapCooldownTime(Handle plugin, int numParams)
|
public int Native_GetMapCooldownTime(Handle plugin, int numParams)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user