From 01c200e1ac167937d899a2e835e6315d71178f08 Mon Sep 17 00:00:00 2001 From: "https://github.com/CrimsonTautology" Date: Wed, 12 Aug 2020 11:51:10 -0400 Subject: [PATCH] fix forced bots --- addons/sourcemod/scripting/mapfix.sp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/mapfix.sp b/addons/sourcemod/scripting/mapfix.sp index 1cc2418..f446dd1 100644 --- a/addons/sourcemod/scripting/mapfix.sp +++ b/addons/sourcemod/scripting/mapfix.sp @@ -34,7 +34,10 @@ public Plugin:myinfo = new Handle:g_CachedTargetTrie = INVALID_HANDLE; new Handle:g_Cvar_Timelimit = INVALID_HANDLE; +new Handle:g_Cvar_BotSlotpct = INVALID_HANDLE; + new bool:g_AutoFlipTimelimit = true; +new bool:g_AutoFlipBotSlotpct = true; public OnPluginStart() { @@ -45,6 +48,9 @@ public OnPluginStart() g_Cvar_Timelimit = FindConVar("mp_timelimit"); HookConVarChange(g_Cvar_Timelimit, OnTimelimitChanged); + g_Cvar_BotSlotpct = FindConVar("fof_sv_bot_slotpct"); + HookConVarChange(g_Cvar_BotSlotpct, OnBotSlotpctChanged); + SetupTeleports(); } @@ -79,8 +85,9 @@ public OnMapStart() PrecacheSound("weapons/gatling/gattling_fire1.wav", true ); PrecacheSound("weapons/gatling/gattling_fire2.wav", true ); - // reset mp_timelimit autoflip checker + // reset mp_timelimit and fof_sv_bot_slotpct autoflip checker g_AutoFlipTimelimit = true; + g_AutoFlipBotSlotpct = true; } public Event_RoundStart(Event:event, const String:name[], bool:dontBroadcast) @@ -104,6 +111,21 @@ public OnTimelimitChanged(Handle:convar, const String:oldValue[], const String:n } +public OnBotSlotpctChanged(Handle:convar, const String:oldValue[], const String:newValue[]) +{ + // prevent bots from being turned on + + // skip if we already did the autoflip + if (!g_AutoFlipBotSlotpct) return; + + if (StrEqual(newValue, "0.300000")) { + PrintToServer("[MapFix] prevent auto change to fof_sv_bot_slotpct; reset to \"%s\"", oldValue); + SetConVarString(convar, oldValue); + g_AutoFlipBotSlotpct = false; + } + +} + public FixCvarBounds() { //Some cvars are blocked from being changed in game; this will remove