Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "[AMXx] Delete Maps By Prefix"
#define PLUGIN_VERSION "1.0"
new const g_MapsPrefix[][] =
{
"cscz_"
"aim_",
"fy_"
};
new g_CvarDeleteTime;
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, "DeagLe.Studio");
g_CvarDeleteTime = register_cvar("md_delete_time", "10.0");
set_task(get_pcvar_float(g_CvarDeleteTime), "Task_DeleteMaps");
}
public Task_DeleteMaps()
{
static MapName[32], CurrentMapName[32], Patch[64];
get_mapname(CurrentMapName, charsmax(CurrentMapName));
new Position, Length, Iterator;
while (read_dir("maps", Position++, MapName, charsmax(MapName), Length))
{
for (Iterator = 0; Iterator < sizeof g_MapsPrefix; Iterator++)
{
if (equal(MapName, g_MapsPrefix[Iterator], strlen(g_MapsPrefix[Iterator])) && !equal(MapName, CurrentMapName))
{
formatex(Patch, charsmax(Patch), "maps/%s", MapName);
delete_file(Patch);
}
}
}
}