Quote:
Originally Posted by 694372459
Hi, thanks for replying
here's my code:
PHP Code:
#include <sourcemod> #include <system2>
#define FTP_HOST "" #define FTP_PORT #define FTP_USER "" #define FTP_PWD "" #define FTP_REQUEST_FILE ""
public OnPluginStart() { RegServerCmd("test_ftp_download", Command_TestDownload); }
public Action:Command_TestDownload(args) { System2FTPRequest ftpRequest = new System2FTPRequest(FtpResponseCallback, FTP_REQUEST_FILE); ftpRequest.SetAuthentication(FTP_USER, FTP_PWD); ftpRequest.SetPort(FTP_PORT); ftpRequest.SetOutputFile("addons/sourcemod/data/test_ftp_download.txt"); ftpRequest.StartRequest(); delete ftpRequest; return Plugin_Handled; }
public void FtpResponseCallback(bool success, const char[] error, System2FTPRequest request, System2FTPResponse response) { if (success) { char file[PLATFORM_MAX_PATH]; request.GetInputFile(file, sizeof(file));
if (strlen(file) > 0) { PrintToServer("Download Finished"); } } }
|
Shouldn't you close (delete) the FTP request handle (only) in the callback?
Also avoid mixing old and new syntax
__________________