Raised This Month: $32 Target: $400
 8% 

[AMX] Auto Updater


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-28-2023 , 16:02   [AMX] Auto Updater
Reply With Quote #1

Basically, it is a system that downloads new versions of your plugins automatically without having to install them manually. It also has a 'license' type of system that checks the IP of the server before downloading updates for the registered plugins. This option can be disabled since some hosts make the use of get_user_ip(0, useless.


It uses json to parse the data and curl to download the json-formated file to the server. Right after it downloads the file from the website, it checks and parses the data to check some informations, they are:

1. Name of the plugin you want to "download"
2. filename.amxx
3. Version
4. Directory
5. License option (in case you want make the plugin licensed only)

The last parameter makes the system also download other files than just .amxx files, such as .ini, .cfgs, .txts etc.

This is how the json-formated file looks like:

PHP Code:
{
    
"1":{
        
"pluginname""Your Plugin Name",
        
"filename""yourpluginname.amxx",
        
"directory""addons/amxmodx/plugins",
        
"version""1.0",
        
"licensecheck"false
    
}


If licensecheck is true, the plugin will check the IP of the server into the database before downloading the file, otherwise, just will download it.

It will check the version of the json-formated file and the version written in the plugin (AKA register_plugin()) before downloading it as well. So to trigger the download function, make the version value of the json-formated file different from the version registered with register_plugin() and thats it.

For files without this version trigger, it'll always download no matter the sizes or versions.
It seemed to be stable for most servers I tried. I also have another one that uses EasyHTTP module.

OBS: Make sure to register your database informations if USE_LICENSE is defined.

PHP Code:
#define DATABASE_HOST         "localhost"
#define DATABASE_USER        "root"
#define DATABASE_PASS        ""
#define DATABASE_NAME        "servers" 
(The EasyHTTP version doesn't use IP checker, it will download all the listed files since licensecheck key is not listed on the json-formated file).

Also, register your server links as well

CURL version:
PHP Code:
// this will be where the json-formated file will be located on your website. The plugin will download it first.
new const g_szWebsitePluginsListFile[] =     "https://www.yourwebsite.com/pluginsList.res"

// this will be where the downloaded file will be stored on the server.
new const g_szJsonFileDirectory[] =         "resource/pluginsList.res"

// this is where your auto-download plugins will be located and downloaded afterwards.
new const g_szWebsitePluginsLink[] =     "https://www.yourwebsite.com/plugins" 
EasyHTTP:

PHP Code:
// this will be where the json-formated file will be located on your website. The plugin will download it first.
new const g_szWebsitePluginsListFile[] =     "http://www.yourwebsite.com/pluginsList.res"

// this will be where the downloaded file will be stored on the server.
new const g_szJsonFileDirectory[] =         "resource/pluginsList.res"

// this is where your auto-download plugins will be located and downloaded afterwards.
new const g_szWebsitePluginsLink[] =         "https://www.yourwebsite.com/plugins" 
Thats all.
Attached Files
File Type: zip AutoUpdater CURL.zip (4.4 KB, 57 views)
File Type: zip AutoUpdater EasyHTTP.zip (2.11 MB, 49 views)
File Type: zip Modules Required.zip (1.88 MB, 33 views)
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 12-02-2023 at 13:10.
EFFx is offline
 


Thread Tools
Display Modes

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 23:43.


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