From 5855e49f78e9735dd586a1980f274f58d274a1cc Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 14 Mar 2026 17:39:25 +0100 Subject: [PATCH] backup map is now based on casualpool --- .../mapchooser_extended_avg_mapend.sp | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp index a72dbed..9a85f51 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp @@ -1035,17 +1035,46 @@ public Action unfreeze_players2(Handle hTimer, Handle dp) public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp) { - char map_line[256]; - File f = OpenFile("cfg/defaultmap.cfg", "r"); - if (f != null) + static char map[PLATFORM_MAX_PATH]; + Handle tempMaps = CloneArray(g_MapList); + + //if we stop using the casual pool feature we instead just rely on the default map to be used. + if (g_iMapsFromCasualPool > 0) { - f.ReadLine(map_line, sizeof(map_line)); - CloseHandle(f); + int b; + for(int j = 0; j < 1000; j++) + { + b = GetRandomInt(0, GetArraySize(tempMaps) - 1); + GetArrayString(tempMaps, b, map, PLATFORM_MAX_PATH); + + if (!InternalGetCasualPool(map)) + { + continue; + } + if (InternalGetMapCooldownTime(map) > GetTime()) + { + continue; + } + //found a map from casual pool to force to. + break; + } + ForceChangeLevel(map, "nobody voted at mapvote"); + } + else + { + + char map_line[256]; + File f = OpenFile("cfg/defaultmap.cfg", "r"); + if (f != null) + { + f.ReadLine(map_line, sizeof(map_line)); + CloseHandle(f); + } + ReplaceString(map_line, sizeof(map_line), "map ", ""); + TrimString(map_line); + //LogMessage("map_line: %s", map_line); + ForceChangeLevel(map_line, "nobody voted at mapvote"); } - ReplaceString(map_line, sizeof(map_line), "map ", ""); - TrimString(map_line); - //LogMessage("map_line: %s", map_line); - ForceChangeLevel(map_line, "nobody voted at mapvote"); return Plugin_Handled; }