This (mostly) replaces my downloader plugin. It uses the sockets module to download a file via HTTP.
This works right now, I wouldn't exactly call it well tested. I'm posting it here rather then in the plugins area as it needs some cleanup before it goes there.
You can get it from
http://devicenull.org/files/downloader.0.0.0.1.zip
It only adds one function:
Code:
functag DownloadFile_Sucess public(any:arg);
functag DownloadFile_Error public(type,num,any:arg);
native DownloadFile(const String:destname[],const String:host[],const String:path[],DownloadFile_Sucess:suc,DownloadFile_Error:err,any:arg);
Example:
Code:
#include <sourcemod>
#include <downloader>
public DownloadFile_Sucess:sucess(arg)
{
PrintToServer("sucess %i",arg);
}
public DownloadFile_Error:error(type,num,arg)
{
PrintToServer("error %i %i %i",type,num,arg);
}
public OnPluginStart()
{
DownloadFile("devicenull.org.txt","www.devicenull.org","",DownloadFile_Sucess:sucess,DownloadFile_Error:error,1337);
}
__________________