added natives in mapchooser for knockback low pop plugin which now on low pop gives infintie ammo and high HP for doing difficult maps
This commit is contained in:
parent
d12aff14ac
commit
d396e006b9
@ -1,6 +1,9 @@
|
||||
#include <sourcemod>
|
||||
#include <BotTargeting>
|
||||
#include <cstrike>
|
||||
#include <mapchooser_extended>
|
||||
|
||||
bool g_bDoingMapTouristMode;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
@ -14,18 +17,39 @@ public Plugin myinfo =
|
||||
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) != 0
|
||||
|| GetMapMinHoursAvg(map) != 0)
|
||||
{
|
||||
g_bDoingMapTouristMode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
int active_player_count = 0;
|
||||
@ -51,15 +75,36 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
|
||||
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);
|
||||
if (g_bDoingMapTouristMode)
|
||||
{
|
||||
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");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
ServerCommand("zr_class_set_multiplier zombies knockback %.2f", 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)
|
||||
{
|
||||
ServerCommand("sm_iammo @all 1");
|
||||
ServerCommand("sm_hp @ct 500");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -115,6 +115,7 @@ native int GetMapMinTime(const char[] map);
|
||||
native int GetMapMaxTime(const char[] map);
|
||||
native int GetMapMinPlayers(const char[] map);
|
||||
native int GetMapMaxPlayers(const char[] map);
|
||||
native int GetMapMinHoursAvg(const char[] map);
|
||||
|
||||
// 0 = Okay
|
||||
// >0 = Minutes till Okay
|
||||
|
||||
@ -484,6 +484,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
||||
CreateNative("GetMapMaxTime", Native_GetMapMaxTime);
|
||||
CreateNative("GetMapMinPlayers", Native_GetMapMinPlayers);
|
||||
CreateNative("GetMapMaxPlayers", Native_GetMapMaxPlayers);
|
||||
CreateNative("GetMapMinHoursAvg", Native_GetMapMinHoursAvg);
|
||||
CreateNative("GetMapTimeRestriction", Native_GetMapTimeRestriction);
|
||||
CreateNative("GetMapPlayerRestriction", Native_GetMapPlayerRestriction);
|
||||
CreateNative("GetMapGroups", Native_GetMapGroups);
|
||||
@ -2778,6 +2779,7 @@ public int Native_GetMapCooldown(Handle plugin, int numParams)
|
||||
return Cooldown;
|
||||
}
|
||||
|
||||
//GetMapCooldownTime
|
||||
public int Native_GetMapCooldownTime(Handle plugin, int numParams)
|
||||
{
|
||||
int len;
|
||||
@ -2789,10 +2791,7 @@ public int Native_GetMapCooldownTime(Handle plugin, int numParams)
|
||||
char[] map = new char[len+1];
|
||||
GetNativeString(1, map, len+1);
|
||||
|
||||
int Cooldown = 0;
|
||||
g_TimeMapList.GetValue(map, Cooldown);
|
||||
|
||||
return Cooldown;
|
||||
return InternalGetMapCooldownTime2(map);
|
||||
}
|
||||
|
||||
public int Native_GetMapMinTime(Handle plugin, int numParams)
|
||||
@ -2837,6 +2836,20 @@ public int Native_GetMapMinPlayers(Handle plugin, int numParams)
|
||||
return InternalGetMapMinPlayers(map);
|
||||
}
|
||||
|
||||
public int Native_GetMapMinHoursAvg(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);
|
||||
|
||||
return InternalGetMapMinHoursAvg(map);
|
||||
}
|
||||
|
||||
public int Native_GetMapMaxPlayers(Handle plugin, int numParams)
|
||||
{
|
||||
int len;
|
||||
@ -3079,6 +3092,22 @@ stock int InternalGetMapCooldown(const char[] map)
|
||||
return Cooldown;
|
||||
}
|
||||
|
||||
stock int InternalGetMapCooldownTime2(const char[] map)
|
||||
{
|
||||
char time[16];
|
||||
int Cooldown = 0;
|
||||
if(g_Config && g_Config.JumpToKey(map))
|
||||
{
|
||||
g_Config.GetString("CooldownTime", time, sizeof(time), "");
|
||||
if(time[0])
|
||||
Cooldown = TimeStrToSeconds(time);
|
||||
|
||||
g_Config.Rewind();
|
||||
}
|
||||
|
||||
return Cooldown;
|
||||
}
|
||||
|
||||
stock int InternalGetMapCooldownTime(const char[] map)
|
||||
{
|
||||
char time[16];
|
||||
@ -3136,6 +3165,17 @@ stock int InternalGetMapMinPlayers(const char[] map)
|
||||
return MinPlayers;
|
||||
}
|
||||
|
||||
stock int InternalGetMapMinHoursAvg(const char[] map)
|
||||
{
|
||||
int MinHoursAvg = 0;
|
||||
if(g_Config && g_Config.JumpToKey(map))
|
||||
{
|
||||
MinHoursAvg = g_Config.GetNum("MinHoursAvg", MinHoursAvg);
|
||||
g_Config.Rewind();
|
||||
}
|
||||
return MinHoursAvg;
|
||||
}
|
||||
|
||||
stock int InternalGetMapMaxPlayers(const char[] map)
|
||||
{
|
||||
int MaxPlayers = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user