From c267fb14579cd0da7c7a10cab4fa1764cc3ae23d Mon Sep 17 00:00:00 2001 From: jenz Date: Fri, 27 Sep 2024 00:51:28 +0200 Subject: [PATCH] moving cvars over to the mapchooser_extended.cfg so people can see the values at https://unloze.com/mapchooser_css_ze/mapchooser_extended.cfg --- .../mapchooser_extended_avg_mapend.sp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp index 61c570fb..8d3727a9 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp @@ -492,8 +492,17 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max return APLRes_Success; } +public Action GetInternalGetCvars(Handle timer) +{ + InternalGetCvars(); //reading some cvars from the mapchooser_extended.cfg instead of server.cfg so people can view the values on + // https://unloze.com/mapchooser_css_ze/mapchooser_extended.cfg + return Plugin_Handled; +} + public void OnMapStart() { + CreateTimer(1.0, GetInternalGetCvars); + int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_RunOffWarningTime) + 10; ServerCommand("sm_cvar mp_chattime %i", total_time); //prevents map switching supposedly. g_DidRoundTerminate = false; @@ -3119,6 +3128,23 @@ stock int InternalGetMapGroups(const char[] map, int[] groups, int size) return found; } +stock void InternalGetCvars() +{ + if (g_Config && g_Config.JumpToKey("_cvars")) + { + g_Config.GotoFirstSubKey(false); + char cvar_name[256]; + char cvar_value[256]; + do + { + g_Config.GetSectionName(cvar_name, sizeof(cvar_name)); + g_Config.GetString(NULL_STRING, cvar_value, sizeof(cvar_value)); + ServerCommand("sm_cvar %s %s", cvar_name, cvar_value); + } while (g_Config.GotoNextKey(false)); + g_Config.Rewind(); + } +} + stock int InternalGetGroupMax(int group) { char groupstr[8];