77#endif
88
99# define PLUGIN " Map Manager: Core"
10- # define VERSION " 3.0.9 "
10+ # define VERSION " 3.0.10 "
1111# define AUTHOR " Mistrick"
1212
1313#pragma semicolon 1
@@ -50,7 +50,8 @@ enum Cvars {
5050 RANDOM_NUMS,
5151 PREPARE_TIME,
5252 VOTE_TIME,
53- VOTE_ITEM_OFFSET
53+ VOTE_ITEM_OFFSET,
54+ ONLY_EXTERNAL_VOTE_ITEMS
5455};
5556
5657new g_pCvars[Cvars];
@@ -72,7 +73,7 @@ new g_iShowPercent;
7273new g_bShowSelects;
7374new g_iTimer;
7475new g_bCanExtend;
75- new g_iMaxItems ;
76+ new g_iExternalMaxItems ;
7677new g_iCurMap;
7778
7879new g_iRandomNums[MAX_VOTELIST_SIZE + 1 ];
@@ -100,6 +101,7 @@ public plugin_init()
100101 g_pCvars[PREPARE_TIME] = register_cvar (" mapm_prepare_time" , " 5" ); // seconds
101102 g_pCvars[VOTE_TIME] = register_cvar (" mapm_vote_time" , " 10" ); // seconds
102103 g_pCvars[VOTE_ITEM_OFFSET] = register_cvar (" mapm_vote_item_offset" , " 0" );
104+ g_pCvars[ONLY_EXTERNAL_VOTE_ITEMS] = register_cvar (" mapm_only_external_vote_items" , " 0" );
103105
104106 g_hForwards[MAPLIST_LOADED] = CreateMultiForward (" mapm_maplist_loaded" , ET_IGNORE, FP_CELL, FP_STRING);
105107 g_hForwards[MAPLIST_UNLOADED] = CreateMultiForward (" mapm_maplist_unloaded" , ET_IGNORE);
@@ -187,7 +189,8 @@ public native_add_map_to_list(plugin, params)
187189 enum {
188190 arg_name = 1 ,
189191 arg_minplayers,
190- arg_maxplayers
192+ arg_maxplayers,
193+ arg_priority
191194 };
192195
193196 new map_info[MapStruct];
@@ -199,6 +202,10 @@ public native_add_map_to_list(plugin, params)
199202
200203 map_info[MinPlayers] = get_param (arg_minplayers);
201204 map_info[MaxPlayers] = get_param (arg_maxplayers);
205+
206+ new priority = clamp (get_param (arg_priority), 0 , 100 );
207+ map_info[MapPriority] = priority ? priority : 100 ;
208+
202209 ArrayPushArray (g_aMapsList, map_info);
203210
204211 return 1 ;
@@ -237,15 +244,15 @@ public native_block_show_vote(plugin, params)
237244}
238245public native_get_votelist_size (plugin, params)
239246{
240- if (g_iMaxItems ) {
241- return g_iMaxItems ;
247+ if (g_iExternalMaxItems ) {
248+ return g_iExternalMaxItems ;
242249 }
243250 return min (min (get_num (VOTELIST_SIZE), MAX_VOTELIST_SIZE), ArraySize (g_aMapsList));
244251}
245252public native_set_votelist_max_items (plugin, params)
246253{
247254 enum { arg_value = 1 };
248- g_iMaxItems = get_param (arg_value);
255+ g_iExternalMaxItems = get_param (arg_value);
249256}
250257public native_push_map_to_votelist (plugin, params)
251258{
@@ -255,7 +262,7 @@ public native_push_map_to_votelist(plugin, params)
255262 arg_ignore_check
256263 };
257264
258- if (g_iMaxItems && g_iVoteItems >= g_iMaxItems ) {
265+ if (g_iExternalMaxItems && g_iVoteItems >= g_iExternalMaxItems ) {
259266 return PUSH_CANCELED;
260267 }
261268
@@ -446,12 +453,12 @@ prepare_vote(type)
446453 new ret;
447454 ExecuteForward (g_hForwards[PREPARE_VOTELIST], ret, type);
448455
449- if (g_iMaxItems ) {
450- vote_max_items = g_iMaxItems ;
451- g_iMaxItems = 0 ;
456+ if (g_iExternalMaxItems ) {
457+ vote_max_items = g_iExternalMaxItems ;
458+ g_iExternalMaxItems = 0 ;
452459 }
453460
454- if (g_iVoteItems < vote_max_items) {
461+ if (! get_num (ONLY_EXTERNAL_VOTE_ITEMS) && g_iVoteItems < vote_max_items) {
455462 new map_info[MapStruct];
456463 for (new random_map; g_iVoteItems < vote_max_items; g_iVoteItems++ ) {
457464 do {
@@ -463,6 +470,10 @@ prepare_vote(type)
463470 }
464471 }
465472
473+ if (! g_iVoteItems) {
474+ log_amx (" Started vote with ZERO items. Check your maps list!" );
475+ }
476+
466477 ExecuteForward (g_hForwards[CAN_BE_EXTENDED], ret, type);
467478 g_bCanExtend = ! ret;
468479
0 commit comments