Raised This Month: $51 Target: $400
 12% 

Solved HTTP:X Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-10-2021 , 14:40   HTTP:X Problem
Reply With Quote #1

Hello. I'm trying to use HTTP:X by Black Rose, but the plugin is updating only when i upload the plugin. I tried to debug it but at the second change map the plugin is not updating:

Code:
PHP Code:
#include <amxmodx>

enum {
    
REQUEST_GET,
    
REQUEST_POST
}

native HTTPX_Download(const URL[], const Filename[] = "", const CompleteHandler[] = "", const ProgressHandler[] = ""Port 0RequestType REQUEST_GET, const Username[] = "", const Password[] = "", ... /* For possible future use */)
native HTTPX_GetData(data[], len)

#define AUTOUPDATE_FILE_ID "76775"
#define AUTOUPDATE_HOW_OFTEN 0 // Download immediately

new const VersionNum =      102
new gHTTPX true;

public 
plugin_init() {

    new 
temp[5];
    
num_to_str(VersionNumtemp[1], charsmax(temp));
    
temp[0] = temp[1];
    
temp[1] = '.';
    
    
register_plugin("HTTP:X Autoupdate example 2"temp"[ --{-@ ]");

    if ( 
gHTTPX )
        
HTTPX_Download("https://lexzor.warface.ro/AutoUpdate/Test/version.txt""dada.amxx""Complete"""_REQUEST_GET""""0, -1);
}

public 
Complete(DownloadIDError) {
    if ( 
Error )
    return;

    new 
temp[16];
    
HTTPX_GetData(tempcharsmax(temp));
    
server_print("%s"temp)
    if ( 
str_to_num(temp) > VersionNum )
    
UpdatePlugin();
}

UpdatePlugin() {
    new 
hHTTPX is_plugin_loaded("HTTP:X");
    
server_print("plugin loaded")
    if ( 
hHTTPX )
    {
        new 
filename[64];
        
get_plugin(hHTTPXfilenamecharsmax(filename));
        
server_print("%s"filename)
        if ( 
callfunc_begin("AutoupdatePlugin"filename) == ) {
            
server_print("auto update start")
            
callfunc_push_int(get_plugin(-1));
            
callfunc_push_str(AUTOUPDATE_FILE_IDfalse);
            
callfunc_push_int(AUTOUPDATE_HOW_OFTEN);
            
callfunc_end();
        }
    }
}

public 
plugin_natives()
set_native_filter("forwardNativeFilter");

public 
forwardNativeFilter(const Native[], IndexTrap) {
    
    if ( 
Trap )
    return 
PLUGIN_CONTINUE;

    if ( 
equal(Native"HTTPX_Download") || equal(Native"HTTPX_GetData") ) {
        
gHTTPX false;
        return 
PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;


Last edited by lexzor; 05-11-2021 at 10:17.
lexzor is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 05-10-2021 , 14:59   Re: HTTP:X Problem
Reply With Quote #2

Use cURL for sending / receiveing data to websites, it is easier, but you need to read some of the API: https://curl.se/libcurl/c/
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-10-2021 , 17:42   Re: HTTP:X Problem
Reply With Quote #3

I recently updated VAC Ban Status to use CURL to allow connections to https servers. You can look at the source to figure out how to use it:
__________________

Last edited by Bugsy; 05-10-2021 at 17:42.
Bugsy is online now
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-11-2021 , 10:17   Re: HTTP:X Problem
Reply With Quote #4

I will use cURL. Thanks.

Last edited by lexzor; 05-11-2021 at 10:17.
lexzor is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:47.


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