View Single Post
)v(aster
Junior Member
Join Date: Feb 2008
Old 07-13-2008 , 16:38   Re: [EXTENSION] Web downloader
Reply With Quote #21

Hi

Not too sure what i've done wrong. When I use the sample plugin, I cant find a file created. And when I run the following, I see this in the sm log:
L 07/14/2008 - 05:07:59: [m_downloadtest.smx] $$$$

EDIT: Worked it out, need to read the string in the DownloadComplete callback, as it's threadded.

Code:
public DownloadComplete(const sucess, const status, Handle:arg)
{
    PrintToServer("DownloadComplete: %i %i",sucess, status);
    CloseHandle(down);
}
public Progress(const recvSize, const totalSize, Handle:arg)
...
 
public OnPluginStart()
{
    down = CreateDownloader();
 
    SetURL(down,"http://domain/file.php/");
 
    SetCallback(down,DownloadComplete);
    SetProgressCallback(down,Progress);
 
    new String:response[1000];
 
    SetOutputString(down,response,sizeof(response));
 
    Download(down);
 
    LogMessage("$$$$%s", response); 
}

Last edited by )v(aster; 07-14-2008 at 14:36.
)v(aster is offline