1.1 --- a/plugins/basecommands.sp Thu Oct 18 01:08:48 2007 +0000
1.2 +++ b/plugins/basecommands.sp Thu Oct 18 01:16:42 2007 +0000
1.3 @@ -86,7 +86,7 @@
1.4
1.5 public OnMapStart()
1.6 {
1.7 - LoadMaps(g_MapList);
1.8 + LoadMapList(g_MapList);
1.9
1.10 ParseConfigs();
1.11 }
2.1 --- a/plugins/basecommands/map.sp Thu Oct 18 01:08:48 2007 +0000
2.2 +++ b/plugins/basecommands/map.sp Thu Oct 18 01:16:42 2007 +0000
2.3 @@ -82,7 +82,7 @@
2.4 return Plugin_Stop;
2.5 }
2.6
2.7 -LoadMaps(Handle:menu)
2.8 +LoadMapList(Handle:menu)
2.9 {
2.10 decl String:mapPath[256];
2.11 BuildPath(Path_SM, mapPath, sizeof(mapPath), "configs/adminmenu_maplist.ini");
3.1 --- a/plugins/basevotes.sp Thu Oct 18 01:08:48 2007 +0000
3.2 +++ b/plugins/basevotes.sp Thu Oct 18 01:16:42 2007 +0000
3.3 @@ -136,7 +136,7 @@
3.4
3.5 public OnMapStart()
3.6 {
3.7 - g_mapCount = LoadMaps(g_MapList);
3.8 + g_mapCount = LoadMapList(g_MapList);
3.9 }
3.10
3.11 public OnAdminMenuReady(Handle:topmenu)
4.1 --- a/plugins/basevotes/votemap.sp Thu Oct 18 01:08:48 2007 +0000
4.2 +++ b/plugins/basevotes/votemap.sp Thu Oct 18 01:16:42 2007 +0000
4.3 @@ -199,7 +199,7 @@
4.4 return Plugin_Handled;
4.5 }
4.6
4.7 -LoadMaps(Handle:menu)
4.8 +LoadMapList(Handle:menu)
4.9 {
4.10 decl String:mapPath[256];
4.11 BuildPath(Path_SM, mapPath, sizeof(mapPath), "configs/adminmenu_maplist.ini");
5.1 --- a/plugins/include/helpers.inc Thu Oct 18 01:08:48 2007 +0000
5.2 +++ b/plugins/include/helpers.inc Thu Oct 18 01:16:42 2007 +0000
5.3 @@ -203,3 +203,86 @@
5.4
5.5 return clients[0];
5.6 }
5.7 +
5.8 +
5.9 +/**
5.10 + * Loads a specified array with maps. The maps will be either loaded from mapcyclefile, or if supplied
5.11 + * a cvar containing a file name. If the file in the cvar is bad, it will use mapcyclefile. The fileTime
5.12 + * parameter is used to store a timestamp of the file. If specified, the file will only be reloaded if it
5.13 + * has changed.
5.14 + *
5.15 + * @param array Valid array handle, should be created with CreateArray(33) or larger.
5.16 + * @param fileTime Variable containing the "last changed" time of the file. Used to avoid needless reloading.
5.17 + * @param fileCvar CVAR set to the file to be loaded. Optional.
5.18 + * @return Number of maps loaded or 0 if in error.
5.19 + */
5.20 + stock LoadMaps(Handle:array, &fileTime = 0, Handle:fileCvar = INVALID_HANDLE)
5.21 + {
5.22 + decl String:mapPath[256], String:mapFile[64];
5.23 + new bool:fileFound = false;
5.24 +
5.25 + if (fileCvar != INVALID_HANDLE)
5.26 + {
5.27 + GetConVarString(fileCvar, mapFile, 64);
5.28 + BuildPath(Path_SM, mapPath, sizeof(mapPath), mapFile);
5.29 + fileFound = FileExists(mapPath);
5.30 + }
5.31 +
5.32 + if (!fileFound)
5.33 + {
5.34 + new Handle:mapCycleFile = FindConVar("mapcyclefile");
5.35 + GetConVarString(mapCycleFile, mapPath, sizeof(mapPath));
5.36 + fileFound = FileExists(mapPath);
5.37 + }
5.38 +
5.39 + if (!fileFound)
5.40 + {
5.41 + LogError("Failed to find a file to load maps from. No maps loaded.");
5.42 + ClearArray(array);
5.43 +
5.44 + return 0;
5.45 + }
5.46 +
5.47 + // If the file hasn't changed, there's no reason to reload
5.48 + // all of the maps.
5.49 + new newTime = GetFileTime(mapPath, FileTime_LastChange);
5.50 + if (fileTime == newTime)
5.51 + {
5.52 + return GetArraySize(array);
5.53 + }
5.54 +
5.55 + fileTime = newTime;
5.56 +
5.57 + ClearArray(array);
5.58 +
5.59 + new Handle:file = OpenFile(mapPath, "rt");
5.60 + if (file == INVALID_HANDLE)
5.61 + {
5.62 + LogError("Could not open file: %s", mapPath);
5.63 +
5.64 + return 0;
5.65 + }
5.66 +
5.67 + LogMessage("Loading maps from file: %s", mapPath);
5.68 +
5.69 + decl String:buffer[64], len;
5.70 + while (!IsEndOfFile(file) && ReadFileLine(file, buffer, sizeof(buffer)))
5.71 + {
5.72 + TrimString(buffer);
5.73 +
5.74 + if ((len = StrContains(buffer, ".bsp", false)) != -1)
5.75 + {
5.76 + buffer[len] = '\0';
5.77 + }
5.78 +
5.79 + if (buffer[0] == '\0' || !IsValidConVarChar(buffer[0]) || !IsMapValid(buffer))
5.80 + {
5.81 + continue;
5.82 + }
5.83 +
5.84 + PushArrayString(array, buffer);
5.85 + }
5.86 +
5.87 + CloseHandle(file);
5.88 + return GetArraySize(array);
5.89 +}
6.1 --- a/plugins/mapchooser.sp Thu Oct 18 01:08:48 2007 +0000
6.2 +++ b/plugins/mapchooser.sp Thu Oct 18 01:16:42 2007 +0000
6.3 @@ -71,8 +71,8 @@
6.4 new Handle:g_MapList = INVALID_HANDLE;
6.5 new Handle:g_OldMapList = INVALID_HANDLE;
6.6 new Handle:g_NextMapList = INVALID_HANDLE;
6.7 +new Handle:g_TeamScores = INVALID_HANDLE;
6.8 new Handle:g_VoteMenu = INVALID_HANDLE;
6.9 -new Handle:g_TeamScores = INVALID_HANDLE;
6.10
6.11 new bool:g_HasVoteStarted;
6.12 new g_mapFileTime;
6.13 @@ -122,7 +122,7 @@
6.14 AutoExecConfig(true, "mapchooser");
6.15 }
6.16
6.17 -public OnMapStart()
6.18 +public OnConfigsExecuted()
6.19 {
6.20 g_Cvar_Nextmap = FindConVar("sm_nextmap");
6.21
6.22 @@ -132,7 +132,7 @@
6.23 SetFailState("sm_nextmap not found");
6.24 }
6.25
6.26 - if (LoadMaps())
6.27 + if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_Mapfile))
6.28 {
6.29 CreateNextVote();
6.30 SetupTimeleftTimer();
6.31 @@ -143,8 +143,18 @@
6.32 public OnMapEnd()
6.33 {
6.34 g_HasVoteStarted = false;
6.35 - g_RetryTimer = INVALID_HANDLE;
6.36 - g_VoteTimer = INVALID_HANDLE;
6.37 +
6.38 + if (g_VoteTimer != INVALID_HANDLE)
6.39 + {
6.40 + KillTimer(g_VoteTimer);
6.41 + g_VoteTimer = INVALID_HANDLE;
6.42 + }
6.43 +
6.44 + if (g_RetryTimer != INVALID_HANDLE)
6.45 + {
6.46 + KillTimer(g_RetryTimer);
6.47 + g_RetryTimer = INVALID_HANDLE;
6.48 + }
6.49 }
6.50
6.51 public OnMapTimeLeftChanged()
6.52 @@ -173,7 +183,7 @@
6.53 g_VoteTimer = INVALID_HANDLE;
6.54 }
6.55
6.56 - g_VoteTimer = CreateTimer(float(time - startTime), Timer_StartMapVote, TIMER_FLAG_NO_MAPCHANGE);
6.57 + g_VoteTimer = CreateTimer(float(time - startTime), Timer_StartMapVote);
6.58 }
6.59 }
6.60 }
6.61 @@ -301,7 +311,7 @@
6.62 if (IsVoteInProgress())
6.63 {
6.64 // Can't start a vote, try again in 5 seconds.
6.65 - g_RetryTimer = CreateTimer(5.0, Timer_StartMapVote, TIMER_FLAG_NO_MAPCHANGE);
6.66 + g_RetryTimer = CreateTimer(5.0, Timer_StartMapVote);
6.67 return;
6.68 }
6.69
6.70 @@ -536,82 +546,4 @@
6.71 PushArrayString(g_NextMapList, map);
6.72 RemoveFromArray(tempMaps, b);
6.73 }
6.74 -}
6.75 -
6.76 -LoadMaps()
6.77 -{
6.78 - new bool:fileFound;
6.79 -
6.80 - decl String:mapPath[256], String:mapFile[64];
6.81 - GetConVarString(g_Cvar_Mapfile, mapFile, 64);
6.82 - BuildPath(Path_SM, mapPath, sizeof(mapPath), mapFile);
6.83 - fileFound = FileExists(mapPath);
6.84 - if (!fileFound)
6.85 - {
6.86 - new Handle:mapCycleFile = FindConVar("mapcyclefile");
6.87 - GetConVarString(mapCycleFile, mapPath, sizeof(mapPath));
6.88 - fileFound = FileExists(mapPath);
6.89 - }
6.90 -
6.91 - if (!fileFound)
6.92 - {
6.93 - LogError("Unable to locate sm_mapvote_file or mapcyclefile, no maps loaded.");
6.94 -
6.95 - if (g_MapList != INVALID_HANDLE)
6.96 - {
6.97 - ClearArray(g_MapList);
6.98 - }
6.99 -
6.100 - return 0;
6.101 - }
6.102 -
6.103 - // If the file hasn't changed, there's no reason to reload
6.104 - // all of the maps.
6.105 - new fileTime = GetFileTime(mapPath, FileTime_LastChange);
6.106 - if (g_mapFileTime == fileTime)
6.107 - {
6.108 - return GetArraySize(g_MapList);
6.109 - }
6.110 -
6.111 - g_mapFileTime = fileTime;
6.112 -
6.113 - // Reset the array
6.114 - if (g_MapList != INVALID_HANDLE)
6.115 - {
6.116 - ClearArray(g_MapList);
6.117 - }
6.118 -
6.119 - LogMessage("[SM] Loading mapchooser map file [%s]", mapPath);
6.120 -
6.121 - new Handle:file = OpenFile(mapPath, "rt");
6.122 - if (file == INVALID_HANDLE)
6.123 - {
6.124 - LogError("[SM] Could not open file: %s", mapPath);
6.125 - return 0;
6.126 - }
6.127 -
6.128 - decl String:currentMap[32];
6.129 - GetCurrentMap(currentMap, sizeof(currentMap));
6.130 -
6.131 - decl String:buffer[64], len;
6.132 - while (!IsEndOfFile(file) && ReadFileLine(file, buffer, sizeof(buffer)))
6.133 - {
6.134 - TrimString(buffer);
6.135 -
6.136 - if ((len = StrContains(buffer, ".bsp", false)) != -1)
6.137 - {
6.138 - buffer[len] = '\0';
6.139 - }
6.140 -
6.141 - if (buffer[0] == '\0' || !IsValidConVarChar(buffer[0]) || !IsMapValid(buffer)
6.142 - || strcmp(currentMap, buffer, false) == 0)
6.143 - {
6.144 - continue;
6.145 - }
6.146 -
6.147 - PushArrayString(g_MapList, buffer);
6.148 - }
6.149 -
6.150 - CloseHandle(file);
6.151 - return GetArraySize(g_MapList);
6.152 }
6.153 \ No newline at end of file
7.1 --- a/plugins/nextmap.sp Thu Oct 18 01:08:48 2007 +0000
7.2 +++ b/plugins/nextmap.sp Thu Oct 18 01:16:42 2007 +0000
7.3 @@ -49,7 +49,6 @@
7.4
7.5 new Handle:g_Cvar_Chattime;
7.6 new Handle:g_Cvar_Nextmap;
7.7 -new Handle:g_Cvar_Mapcycle;
7.8
7.9 new g_MapPos = -1;
7.10 new Handle:g_MapList = INVALID_HANDLE;
7.11 @@ -67,21 +66,18 @@
7.12 SetFailState("VGUIMenu Not Found");
7.13 }
7.14
7.15 - g_Cvar_Chattime = FindConVar("mp_chattime");
7.16 - g_Cvar_Mapcycle = FindConVar("mapcyclefile");
7.17 -
7.18 g_MapList = CreateArray(32);
7.19
7.20 - if (!LoadMaps())
7.21 + if (!LoadMaps(g_MapList, g_mapFileTime))
7.22 {
7.23 LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
7.24 SetFailState("Mapcycle Not Found");
7.25 }
7.26
7.27 HookUserMessage(g_VGUIMenu, UserMsg_VGUIMenu);
7.28 - HookConVarChange(g_Cvar_Mapcycle, ConVarChange_Mapcyclefile);
7.29
7.30 g_Cvar_Nextmap = CreateConVar("sm_nextmap", "", "Sets the Next Map", FCVAR_NOTIFY);
7.31 + g_Cvar_Chattime = FindConVar("mp_chattime");
7.32
7.33 RegConsoleCmd("say", Command_Say);
7.34 RegConsoleCmd("say_team", Command_Say);
7.35 @@ -106,7 +102,7 @@
7.36 // not in mapcyclefile. So we keep it set to the last expected nextmap. - ferret
7.37 if (strcmp(lastMap, currentMap) == 0)
7.38 {
7.39 - if (!LoadMaps())
7.40 + if (!LoadMaps(g_MapList, g_mapFileTime))
7.41 {
7.42 LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
7.43 SetFailState("Mapcycle Not Found");
7.44 @@ -120,21 +116,7 @@
7.45 {
7.46 g_IntermissionCalled = false;
7.47 }
7.48 -
7.49 -public ConVarChange_Mapcyclefile(Handle:convar, const String:oldValue[], const String:newValue[])
7.50 -{
7.51 - if (strcmp(oldValue, newValue, false) != 0)
7.52 - {
7.53 - if (!LoadMaps())
7.54 - {
7.55 - LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
7.56 - SetFailState("Mapcycle Not Found");
7.57 - }
7.58 -
7.59 - FindAndSetNextMap();
7.60 - }
7.61 -}
7.62 -
7.63 +
7.64 public Action:Command_Say(client, args)
7.65 {
7.66 decl String:text[192];
7.67 @@ -254,59 +236,6 @@
7.68 return Plugin_Stop;
7.69 }
7.70
7.71 -LoadMaps()
7.72 -{
7.73 - decl String:mapCycle[64];
7.74 - GetConVarString(g_Cvar_Mapcycle, mapCycle, 64);
7.75 -
7.76 - if (!FileExists(mapCycle))
7.77 - {
7.78 - LogError("[SM] Could not find file: %s", mapCycle);
7.79 - return 0;
7.80 - }
7.81 -
7.82 - new fileTime = GetFileTime(mapCycle, FileTime_LastChange);
7.83 - if (g_mapFileTime == fileTime)
7.84 - {
7.85 - return GetArraySize(g_MapList);
7.86 - }
7.87 -
7.88 - g_mapFileTime = fileTime;
7.89 -
7.90 - new Handle:file = OpenFile(mapCycle, "r");
7.91 -
7.92 - if (file == INVALID_HANDLE)
7.93 - {
7.94 - LogError("[SM] Could not open file: %s", mapCycle);
7.95 - return 0;
7.96 - }
7.97 -
7.98 - g_MapPos = -1;
7.99 - if (g_MapList != INVALID_HANDLE)
7.100 - {
7.101 - ClearArray(g_MapList);
7.102 - }
7.103 -
7.104 - decl String:buffer[255];
7.105 - while (!IsEndOfFile(file) && ReadFileLine(file, buffer, sizeof(buffer)))
7.106 - {
7.107 - TrimString(buffer);
7.108 - if (buffer[0] == '\0' || buffer[0] == ';')
7.109 - {
7.110 - continue;
7.111 - }
7.112 -
7.113 - if (IsMapValid(buffer))
7.114 - {
7.115 - PushArrayString(g_MapList, buffer);
7.116 - }
7.117 - }
7.118 -
7.119 - CloseHandle(file);
7.120 -
7.121 - return GetArraySize(g_MapList);
7.122 -}
7.123 -
7.124 FindAndSetNextMap()
7.125 {
7.126 new mapCount = GetArraySize(g_MapList);
8.1 --- a/plugins/randomcycle.sp Thu Oct 18 01:08:48 2007 +0000
8.2 +++ b/plugins/randomcycle.sp Thu Oct 18 01:16:42 2007 +0000
8.3 @@ -62,7 +62,7 @@
8.4 AutoExecConfig(true, "randomcycle");
8.5 }
8.6
8.7 -public OnMapStart()
8.8 +public OnConfigsExecuted()
8.9 {
8.10 g_Cvar_Nextmap = FindConVar("sm_nextmap");
8.11
8.12 @@ -72,7 +72,7 @@
8.13 SetFailState("sm_nextmap not found");
8.14 }
8.15
8.16 - if (LoadMaps())
8.17 + if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_Mapfile))
8.18 {
8.19 CreateTimer(5.0, Timer_RandomizeNextmap); // Small delay to give Nextmap time to complete OnMapStart()
8.20 }
8.21 @@ -108,82 +108,4 @@
8.22 LogMessage("RandomCycle has chosen %s for the nextmap.", map);
8.23
8.24 return Plugin_Stop;
8.25 -}
8.26 -
8.27 -LoadMaps()
8.28 -{
8.29 - new bool:fileFound;
8.30 -
8.31 - decl String:mapPath[256], String:mapFile[64];
8.32 - GetConVarString(g_Cvar_Mapfile, mapFile, 64);
8.33 - BuildPath(Path_SM, mapPath, sizeof(mapPath), mapFile);
8.34 - fileFound = FileExists(mapPath);
8.35 - if (!fileFound)
8.36 - {
8.37 - new Handle:mapCycleFile = FindConVar("mapcyclefile");
8.38 - GetConVarString(mapCycleFile, mapPath, sizeof(mapPath));
8.39 - fileFound = FileExists(mapPath);
8.40 - }
8.41 -
8.42 - if (!fileFound)
8.43 - {
8.44 - LogError("Unable to locate sm_randomcycle_file or mapcyclefile, no maps loaded.");
8.45 -
8.46 - if (g_MapList != INVALID_HANDLE)
8.47 - {
8.48 - ClearArray(g_MapList);
8.49 - }
8.50 -
8.51 - return 0;
8.52 - }
8.53 -
8.54 - // If the file hasn't changed, there's no reason to reload
8.55 - // all of the maps.
8.56 - new fileTime = GetFileTime(mapPath, FileTime_LastChange);
8.57 - if (g_mapFileTime == fileTime)
8.58 - {
8.59 - return GetArraySize(g_MapList);
8.60 - }
8.61 -
8.62 - g_mapFileTime = fileTime;
8.63 -
8.64 - // Reset the array
8.65 - if (g_MapList != INVALID_HANDLE)
8.66 - {
8.67 - ClearArray(g_MapList);
8.68 - }
8.69 -
8.70 - LogMessage("[SM] Loading Random Cycle map file [%s]", mapPath);
8.71 -
8.72 - new Handle:file = OpenFile(mapPath, "rt");
8.73 - if (file == INVALID_HANDLE)
8.74 - {
8.75 - LogError("[SM] Could not open file: %s", mapPath);
8.76 - return 0;
8.77 - }
8.78 -
8.79 - decl String:currentMap[32];
8.80 - GetCurrentMap(currentMap, sizeof(currentMap));
8.81 -
8.82 - decl String:buffer[64], len;
8.83 - while (!IsEndOfFile(file) && ReadFileLine(file, buffer, sizeof(buffer)))
8.84 - {
8.85 - TrimString(buffer);
8.86 -
8.87 - if ((len = StrContains(buffer, ".bsp", false)) != -1)
8.88 - {
8.89 - buffer[len] = '\0';
8.90 - }
8.91 -
8.92 - if (buffer[0] == '\0' || !IsValidConVarChar(buffer[0]) || !IsMapValid(buffer)
8.93 - || strcmp(currentMap, buffer, false) == 0)
8.94 - {
8.95 - continue;
8.96 - }
8.97 -
8.98 - PushArrayString(g_MapList, buffer);
8.99 - }
8.100 -
8.101 - CloseHandle(file);
8.102 - return GetArraySize(g_MapList);
8.103 }
8.104 \ No newline at end of file
9.1 --- a/plugins/rockthevote.sp Thu Oct 18 01:08:48 2007 +0000
9.2 +++ b/plugins/rockthevote.sp Thu Oct 18 01:16:42 2007 +0000
9.3 @@ -88,7 +88,7 @@
9.4 AutoExecConfig(true, "rtv");
9.5 }
9.6
9.7 -public OnMapStart()
9.8 +public OnConfigsExecuted()
9.9 {
9.10 if (g_RTVMapList != INVALID_HANDLE)
9.11 {
9.12 @@ -101,16 +101,12 @@
9.13 g_RTVStarted = false;
9.14 g_RTVEnded = false;
9.15
9.16 - if (LoadMaps())
9.17 + if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_File))
9.18 {
9.19 BuildMapMenu();
9.20 g_CanRTV = true;
9.21 CreateTimer(30.0, Timer_DelayRTV);
9.22 }
9.23 - else
9.24 - {
9.25 - LogMessage("[SM] Cannot find map cycle file, RTV not active.");
9.26 - }
9.27 }
9.28
9.29 public OnMapEnd()
9.30 @@ -528,82 +524,4 @@
9.31 }
9.32
9.33 SetMenuExitButton(g_MapMenu, false);
9.34 -}
9.35 -
9.36 -LoadMaps()
9.37 -{
9.38 - new bool:fileFound;
9.39 -
9.40 - decl String:mapPath[256], String:mapFile[64];
9.41 - GetConVarString(g_Cvar_File, mapFile, 64);
9.42 - BuildPath(Path_SM, mapPath, sizeof(mapPath), mapFile);
9.43 - fileFound = FileExists(mapPath);
9.44 - if (!fileFound)
9.45 - {
9.46 - new Handle:mapCycleFile = FindConVar("mapcyclefile");
9.47 - GetConVarString(mapCycleFile, mapPath, sizeof(mapPath));
9.48 - fileFound = FileExists(mapPath);
9.49 - }
9.50 -
9.51 - if (!fileFound)
9.52 - {
9.53 - LogError("Unable to locate sm_rtv_file or mapcyclefile, no maps loaded.");
9.54 -
9.55 - if (g_MapList != INVALID_HANDLE)
9.56 - {
9.57 - ClearArray(g_MapList);
9.58 - }
9.59 -
9.60 - return 0;
9.61 - }
9.62 -
9.63 - // If the file hasn't changed, there's no reason to reload
9.64 - // all of the maps.
9.65 - new fileTime = GetFileTime(mapPath, FileTime_LastChange);
9.66 - if (g_mapFileTime == fileTime)
9.67 - {
9.68 - return GetArraySize(g_MapList);
9.69 - }
9.70 -
9.71 - g_mapFileTime = fileTime;
9.72 -
9.73 - // Reset the array
9.74 - if (g_MapList != INVALID_HANDLE)
9.75 - {
9.76 - ClearArray(g_MapList);
9.77 - }
9.78 -
9.79 - LogMessage("[SM] Loading RTV map file [%s]", mapPath);
9.80 -
9.81 - decl String:currentMap[32];
9.82 - GetCurrentMap(currentMap, sizeof(currentMap));
9.83 -
9.84 - new Handle:file = OpenFile(mapPath, "rt");
9.85 - if (file == INVALID_HANDLE)
9.86 - {
9.87 - LogError("[SM] Could not open file: %s", mapPath);
9.88 - return 0;
9.89 - }
9.90 -
9.91 - decl String:buffer[64], len;
9.92 - while (!IsEndOfFile(file) && ReadFileLine(file, buffer, sizeof(buffer)))
9.93 - {
9.94 - TrimString(buffer);
9.95 -
9.96 - if ((len = StrContains(buffer, ".bsp", false)) != -1)
9.97 - {
9.98 - buffer[len] = '\0';
9.99 - }
9.100 -
9.101 - if (buffer[0] == '\0' || !IsValidConVarChar(buffer[0]) || !IsMapValid(buffer)
9.102 - || strcmp(currentMap, buffer, false) == 0)
9.103 - {
9.104 - continue;
9.105 - }
9.106 -
9.107 - PushArrayString(g_MapList, buffer);
9.108 - }
9.109 -
9.110 - CloseHandle(file);
9.111 - return GetArraySize(g_MapList);
9.112 }
9.113 \ No newline at end of file