Automatically check for plugin updates on server start, or once per day, or manually via command.
Downloads a list of links to check, each webpage containing lists of plugins and their latest version numbers from various authors (currently only Silvers).
Compares the servers version cvars from these lists with their latest known version number.
A future version by Dragokas will hopefully include most plugins on AM. I've uploaded this as a proof-of-concept and demonstrating some code.
The command sm_updates_config opens the file data/plugin_updates.cfg on the server (the file format is shown in the example below, or here).
The file is read and an updated version is saved to data/plugin_updates_cmd.cfg with the latest version numbers found running on the server from the listed plugins.
Lists are maintained by plugin authors. (Please submit links to be included in the default main list).
The webpages must be raw with no other data except a list of plugins in the following format:
For example:
Spoiler
PHP Code:
"cvar_version_name", "latest version number", "URL to the plugin", "Plugin name and possibly plugin filename"
PHP Code:
// Single line comments starting with // are allowed.
"attachments_api_version", "1.6", "https://forums.alliedmods.net/showthread.php?t=325651", "Attachments API (attachments_api.sp)"
"charms_version", "1.13", "https://forums.alliedmods.net/showthread.php?t=325652", "Weapon Charms (charms.sp)"
Admin Commands: (requires "z" flag)
PHP Code:
sm_updates // Check for plugin updates.
sm_updates_config // Updates the data/plugin_updates.cfg config with detected cvar version numbers from plugins listed in the config.
CVars:
Saved to sm_updates_checker.cfg in your servers \cfg\sourcemod\ folder.
PHP Code:
// 0=Manual checking only. 1=Automatically check on server start. 2=Check on server start and once per day (if uptime >= 24 hours).
sm_updates_auto "1"
// Ignores plugins using these version cvars, separate by commas (no spaces).
sm_updates_ignore ""
// 0=Print to server console. 1=Logs to sourcecmod/logs/plugin_updates.txt listing plugins whose version differs from the servers. 2=Print to server console and logs to file.
sm_updates_logs "2"
1.6 (14-Jul-2022)
- Fixed plugin version not being set.
- Fixed "Invalid memory access" error. Thanks to "Psyk0tik" for reporting and testing.
1.5 (18-Apr-2022)
- Fixed some servers not displaying the updates and throwing an error. Thanks to "Psyk0tik" for reporting and testing.
1.4 (07-Nov-2021)
- No longer checks for updates every map change.
1.3 (06-Nov-2021)
- Removed timeout restriction for checking on updates.
- Changes to fix warnings when compiling on SourceMod 1.11.
1.2 (20-Jul-2021)
- Made the error message clearer about missing extensions.
1.1 (13-Jul-2021)
- Fixed "Native "HTTPClient.HTTPClient" was not found" error.
1.0 (20-Apr-2021)
- Initial release.
0.1 (25-May-2020)
- Initial creation.
Compiling:
You MUST download the include files from these extensions.