| Merciless |
09-21-2012 12:13 |
Precache error
Hello,
trying to make a easy Map Downloader,
but the problem is.. when I download map.
1. There doesnt come that the download is complete.
2. But when U see if FTP that it doesnt download anymore (so its done in my eyes), if you change map, server crashes with a precache error
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <httpdl>
#include <colorchat>
#define PLUGIN "Map Downloader"
#define VERSION "1.0"
#define AUTHOR "Xalus"
new const mapWebsites[2][2][] =
{
{"http://cs-front.info/files/cstrike/maps/", "Cs-front"},
{"http://download.gameszone.ro/cs/maps/", "Gameszone"}
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
// Register: Concmd
register_concmd("amx_download", "Cmd_Download", ADMIN_RCON, "<map name>");
}
public Cmd_Download(id, level, cid)
{
if( !cmd_access(id, level, cid, 2) )
return PLUGIN_HANDLED;
new argName[200];
read_argv(1, argName, charsmax(argName))
strtolower(argName)
if(is_map_valid(argName))
{
console_print(id, "[Map Downloader] That map already excists on the server..")
return PLUGIN_HANDLED
}
// add .bsp if needed
if(containi(argName, ".bsp") < 0)
add(argName, charsmax(argName), ".bsp")
new szTemp[2][201]
formatex(szTemp[0], 200, "maps/%s", argName)
for(new i = 0; i < sizeof(mapWebsites); i++)
{
console_print(id, "[Map Downloader] Trying to find map on %s", mapWebsites[i][1])
if(download(szTemp[1], szTemp[0]))
{
console_print(id, "[Map Downloader] Started downloading '%s' from '%s'.", argName, mapWebsites[i][1])
ColorChat(0, GREY, "^4[Map Downloader]^1 Started downloading '%s' from '%s'.", argName, mapWebsites[i][1])
return PLUGIN_CONTINUE
}
}
console_print(id, "[Map Downloader] Couldn't find and or download '%s'", argName)
return PLUGIN_CONTINUE
}
public dlcomplete(id, file[])
{
ColorChat(0, GREY, "^4[Map Downloader]^1 Downloading '%s' is completed and ready to play.", file)
/*
new logs_path[128];
formatex(logs_path, 127, "addons\amxmodx\config/maps.ini");
new main_text[512];
formatex(main_text, 511, "^n; Installed with map downloader^n%s", file);
write_file(logs_path,main_text,-1)
*/
//write_file(logs_path, "---------------------------------------------------", -1);
}
|