Skip to content

Commit b3b6327

Browse files
committed
advanced_lists: rework lists load
1 parent 7dff7fb commit b3b6327

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

addons/amxmodx/scripting/map_manager_adv_lists.sma

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <map_manager>
33

44
#define PLUGIN "Map Manager: Advanced lists"
5-
#define VERSION "0.0.3"
5+
#define VERSION "0.0.4"
66
#define AUTHOR "Mistrick"
77

88
#pragma semicolon 1
@@ -57,14 +57,14 @@ public native_get_list_name(plugin, params)
5757
ArrayGetArray(g_aLists, item, list_info);
5858
set_string(arg_list_name, list_info[ListName], get_param(arg_size));
5959
}
60-
public native_get_list_array(plugin, params)
60+
public Array:native_get_list_array(plugin, params)
6161
{
6262
enum {
6363
arg_item = 1
6464
};
6565

6666
new item = ArrayGetCell(g_aActiveLists, get_param(arg_item));
67-
return _:g_aMapLists[item];
67+
return g_aMapLists[item];
6868
}
6969
public plugin_cfg()
7070
{
@@ -107,13 +107,18 @@ public plugin_cfg()
107107
list_info[StopTime] = get_int_time(stop);
108108
}
109109

110-
ArrayPushArray(g_aLists, list_info);
111-
112110
// load maps from file to local list
113111
g_aMapLists[i] = ArrayCreate(MapStruct, 1);
114-
mapm_load_maplist_to_array(g_aMapLists[i], list_info[FileList]);
112+
113+
if(!mapm_load_maplist_to_array(g_aMapLists[i], list_info[FileList])) {
114+
ArrayDestroy(g_aMapLists[i]);
115+
continue;
116+
}
117+
115118
i++;
116119

120+
ArrayPushArray(g_aLists, list_info);
121+
117122
list_info[AnyTime] = false;
118123
list_info[StartTime] = 25 * 60;
119124
list_info[StopTime] = -1;
@@ -161,7 +166,7 @@ public task_check_list()
161166
}
162167
}
163168

164-
new reload = false;
169+
new bool:reload = false;
165170

166171
if(ArraySize(g_aActiveLists) != ArraySize(temp)) {
167172
reload = true;

0 commit comments

Comments
 (0)