1515// -----------------------------------------------------//
1616// Consts
1717// -----------------------------------------------------//
18- // make this cvar?
19- # define VOTELIST_SIZE 5
20-
18+ # define MAX_VOTELIST_SIZE 8
2119new const FILE_MAPS[] = " maps.ini" ;
2220// -----------------------------------------------------//
2321
4947
5048enum Cvars {
5149 PREFIX,
50+ VOTELIST_SIZE,
5251 SHOW_RESULT_TYPE,
5352 SHOW_SELECTS,
5453 RANDOM_NUMS,
@@ -59,8 +58,8 @@ enum Cvars {
5958new g_pCvars[Cvars];
6059
6160new g_iVoteItems;
62- new g_sVoteList[VOTELIST_SIZE + 1 ][MAPNAME_LENGTH];
63- new g_iVotes[VOTELIST_SIZE + 1 ];
61+ new g_sVoteList[MAX_VOTELIST_SIZE + 1 ][MAPNAME_LENGTH];
62+ new g_iVotes[MAX_VOTELIST_SIZE + 1 ];
6463new g_iTotalVotes;
6564new g_iVoted[33 ];
6665
@@ -75,7 +74,7 @@ new g_bCanExtend;
7574new g_iMaxItems;
7675new g_iCurMap;
7776
78- new g_iRandomNums[VOTELIST_SIZE + 1 ];
77+ new g_iRandomNums[MAX_VOTELIST_SIZE + 1 ];
7978
8079new g_iVoteType;
8180new bool: g_bVoteStarted;
@@ -91,6 +90,7 @@ public plugin_init()
9190 register_cvar (" mapm_version" , VERSION, FCVAR_SERVER | FCVAR_SPONLY);
9291
9392 g_pCvars[PREFIX] = register_cvar (" mapm_prefix" , " ^4[MapManager]" );
93+ g_pCvars[VOTELIST_SIZE] = register_cvar (" mapm_votelist_size" , " 5" );
9494 g_pCvars[SHOW_RESULT_TYPE] = register_cvar (" mapm_show_result_type" , " 1" ); // 0 - disable, 1 - menu, 2 - hud
9595 g_pCvars[SHOW_SELECTS] = register_cvar (" mapm_show_selects" , " 1" ); // 0 - disable, 1 - all
9696 g_pCvars[RANDOM_NUMS] = register_cvar (" mapm_random_nums" , " 0" ); // 0 - disable, 1 - enable
@@ -174,7 +174,7 @@ public native_stop_vote(plugin, params)
174174}
175175public native_get_votelist_size (plugin, params)
176176{
177- return VOTELIST_SIZE;
177+ return min ( get_num ( VOTELIST_SIZE), MAX_VOTELIST_SIZE) ;
178178}
179179public native_set_votelist_max_items (plugin, params)
180180{
@@ -189,7 +189,7 @@ public native_push_map_to_votelist(plugin, params)
189189 arg_ignore_check
190190 };
191191
192- if (g_iVoteItems >= min (VOTELIST_SIZE, ArraySize (g_aMapsList))) {
192+ if (g_iVoteItems >= min (min ( get_num ( VOTELIST_SIZE), MAX_VOTELIST_SIZE) , ArraySize (g_aMapsList))) {
193193 return PUSH_CANCELED;
194194 }
195195
@@ -255,7 +255,7 @@ public plugin_cfg()
255255 server_exec ();
256256
257257 get_mapname (g_sCurMap, charsmax (g_sCurMap));
258-
258+
259259 get_pcvar_string (g_pCvars[PREFIX], g_sPrefix, charsmax (g_sPrefix));
260260 replace_color_tag (g_sPrefix, charsmax (g_sPrefix));
261261
@@ -278,7 +278,6 @@ load_maplist(const file[])
278278 }
279279
280280 new map_info[MapStruct], text[48 ], map[MAPNAME_LENGTH], first_map[MAPNAME_LENGTH], min[3 ], max[3 ], bool: nextmap, bool: found_nextmap;
281- new cur_map[MAPNAME_LENGTH]; get_mapname (cur_map, charsmax (cur_map));
282281
283282 while (! feof (f)) {
284283 fgets (f, text, charsmax (text));
@@ -289,7 +288,7 @@ load_maplist(const file[])
289288 if (! first_map[0 ]) {
290289 copy (first_map, charsmax (first_map), map);
291290 }
292- if (equali (map, cur_map )) {
291+ if (equali (map, g_sCurMap )) {
293292 nextmap = true ;
294293 continue ;
295294 }
@@ -342,7 +341,7 @@ prepare_vote(type)
342341 arrayset (g_iVotes, 0 , sizeof (g_iVotes));
343342
344343 new array_size = ArraySize (g_aMapsList);
345- new vote_max_items = min (VOTELIST_SIZE, array_size);
344+ new vote_max_items = min (min ( get_num ( VOTELIST_SIZE), MAX_VOTELIST_SIZE) , array_size);
346345
347346 new ret;
348347 ExecuteForward (g_hForwards[PREPARE_VOTELIST], ret, type);
@@ -455,8 +454,6 @@ public countdown(taskid)
455454 finish_vote ();
456455 }
457456 }
458-
459-
460457}
461458start_vote ()
462459{
0 commit comments