Skip to content

Commit 337b755

Browse files
authored
Added a command to refresh mapchooser map list (#2431)
1 parent a3f0b99 commit 337b755

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

plugins/mapchooser.sp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public void OnPluginStart()
138138

139139
RegAdminCmd("sm_mapvote", Command_Mapvote, ADMFLAG_CHANGEMAP, "sm_mapvote - Forces MapChooser to attempt to run a map vote now.");
140140
RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>");
141+
RegAdminCmd("sm_mapchooser_refresh", Command_MapchooserRefresh, ADMFLAG_CONVARS, "sm_mapchooser_refresh - refresh map vote map list.");
141142

142143
g_Cvar_Winlimit = FindConVar("mp_winlimit");
143144
g_Cvar_Maxrounds = FindConVar("mp_maxrounds");
@@ -334,6 +335,27 @@ public Action Command_SetNextmap(int client, int args)
334335
return Plugin_Handled;
335336
}
336337

338+
public Action Command_MapchooserRefresh(int client, int args)
339+
{
340+
if (g_HasVoteStarted) return Plugin_Handled;
341+
342+
if (ReadMapList(g_MapList,
343+
g_mapFileSerial,
344+
"mapchooser",
345+
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
346+
!= null)
347+
{
348+
if (g_mapFileSerial == -1)
349+
{
350+
LogError("Unable to create a valid map list. (Command_MapchooserRefresh)");
351+
}
352+
}
353+
354+
CreateNextVote();
355+
356+
return Plugin_Handled;
357+
}
358+
337359
public void OnMapTimeLeftChanged()
338360
{
339361
if (g_MapList.Length)

0 commit comments

Comments
 (0)