Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions addons/amxmodx/scripting/box_storage.sma
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,34 @@ public plugin_end()
}
save_boxes()
{
new configsdir[256];
get_configsdir(configsdir, charsmax(configsdir));
new filepath[256];
get_configsdir(filepath, charsmax(filepath));

add(filepath, charsmax(filepath), "/box_with_boxes");

if (!dir_exists(filepath)) {
mkdir(filepath);
}

add(filepath, charsmax(filepath), "/maps");

if (!dir_exists(filepath)) {
mkdir(filepath);
}

new map[32];
get_mapname(map, charsmax(map));

add(filepath, charsmax(filepath), fmt("/%s.ini", map));

new f;
new ent = -1;
while((ent = find_ent_by_class(ent, BOX_CLASSNAME))) {

if(!f) {
f = fopen(fmt("%s/box_with_boxes/maps/%s.ini", configsdir, map), "w");
f = fopen(filepath, "w");
if(!f) {
// TODO: warn?
log_amx("Error creating/opening coordinates file <%s>", filepath);
return;
}
}
Expand Down