AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Precache error (https://forums.alliedmods.net/showthread.php?t=196458)

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(PLUGINVERSIONAUTHOR)
    
    
// Register: Concmd
    
register_concmd("amx_download""Cmd_Download"ADMIN_RCON"<map name>");
}
public 
Cmd_Download(idlevelcid)
{
    if( !
cmd_access(idlevelcid2) ) 
        return 
PLUGIN_HANDLED;
    
    new 
argName[200];
    
read_argv(1argNamecharsmax(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(argNamecharsmax(argName), ".bsp")  
    
    new 
szTemp[2][201]
    
formatex(szTemp[0], 200"maps/%s"argName)
        
    for(new 
0sizeof(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'."argNamemapWebsites[i][1])
            
ColorChat(0GREY"^4[Map Downloader]^1 Started downloading '%s' from '%s'."argNamemapWebsites[i][1])
        
            return 
PLUGIN_CONTINUE
        
}
    }
    
console_print(id"[Map Downloader] Couldn't find and or download '%s'"argName)
    return 
PLUGIN_CONTINUE
}
public 
dlcomplete(idfile[])
{
    
ColorChat(0GREY"^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);




All times are GMT -4. The time now is 08:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.