You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/mapchooser.sp
+68Lines changed: 68 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,7 @@ ConVar g_Cvar_ExtendRoundStep;
63
63
ConVarg_Cvar_ExtendFragStep;
64
64
ConVarg_Cvar_ExcludeMaps;
65
65
ConVarg_Cvar_IncludeMaps;
66
+
ConVarg_Cvar_PersistentMaps;
66
67
ConVarg_Cvar_NoVoteMode;
67
68
ConVarg_Cvar_Extend;
68
69
ConVarg_Cvar_DontChange;
@@ -127,6 +128,7 @@ public void OnPluginStart()
127
128
g_Cvar_ExtendFragStep=CreateConVar("sm_extendmap_fragstep", "10", "Specifies how many more frags are allowed when map is extended.", _, true, 5.0);
128
129
g_Cvar_ExcludeMaps=CreateConVar("sm_mapvote_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
129
130
g_Cvar_IncludeMaps=CreateConVar("sm_mapvote_include", "5", "Specifies how many maps to include in the vote.", _, true, 2.0, true, 6.0);
131
+
g_Cvar_PersistentMaps=CreateConVar("sm_mapvote_persistentmaps", "0", "Specifies if previous maps should be stored persistently.", _, true, 0.0, true, 1.0);
130
132
g_Cvar_NoVoteMode=CreateConVar("sm_mapvote_novote", "1", "Specifies whether or not MapChooser should pick a map if no votes are received.", _, true, 0.0, true, 1.0);
131
133
g_Cvar_Extend=CreateConVar("sm_mapvote_extend", "0", "Number of extensions allowed each map.", _, true, 0.0);
132
134
g_Cvar_DontChange=CreateConVar("sm_mapvote_dontchange", "1", "Specifies if a 'Don't Change' option should be added to early votes", _, true, 0.0);
@@ -217,6 +219,18 @@ public void OnConfigsExecuted()
217
219
}
218
220
}
219
221
222
+
/* First-load previous maps from a text file when persistency is enabled. */
223
+
staticboolg_FirstConfigExec=true;
224
+
if (g_FirstConfigExec)
225
+
{
226
+
if (g_Cvar_PersistentMaps.BoolValue)
227
+
{
228
+
ReadPreviousMapsFromText();
229
+
}
230
+
231
+
g_FirstConfigExec=false;
232
+
}
233
+
220
234
CreateNextVote();
221
235
SetupTimeleftTimer();
222
236
@@ -264,6 +278,11 @@ public void OnMapEnd()
264
278
{
265
279
g_OldMapList.Erase(0);
266
280
}
281
+
282
+
if (g_Cvar_PersistentMaps.BoolValue)
283
+
{
284
+
WritePreviousMapsToText();
285
+
}
267
286
}
268
287
269
288
publicvoidOnClientDisconnect(intclient)
@@ -1223,3 +1242,52 @@ public int Native_GetNominatedMapList(Handle plugin, int numParams)
1223
1242
1224
1243
return;
1225
1244
}
1245
+
1246
+
/* Add functions for persistent previous map storage */
0 commit comments