I've modified compile.sh and created update.sh to simplify the process of compiling plugins and updating AMXX on unix based operating systems.
More information and examples shown below.
compile.sh >
Compile single or multiple files
Compile all source files
Check compiler version
- Compile single or multiple files
Single file: ./compile.sh admin.sma
Multiple files: ./compile.sh admin.sma adminchat.sma admincmd.sma
- Compile all source files ./compile.sh
All compiled plugins are located at addons/amxmodx/scripting/compiled
- Display help menu
Code:
./compile.sh --help
Usage:
--help (-h) : This menu
--version (-v) : AMX MOD X Compiler version
To compile all source files in the directory
execute the script without any parameters
To compile specific or multiple source files
execute the script with parameters set as source files' name
e.g ./compile.sh admin.sma admincmd.sma adminchat.sma
- Check compiler version
Code:
./compile.sh --version
AMX Mod X Compiler 1.9.0.5270
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team
update.sh >
Get latest version of AMX MOD X
Update game files to either 1.9 or 1.10 based on your choice
Autoupdate the game files
Setup the autoupdater
File backup
Update specific files for configs folder, default: hamdata.ini (version 1.9 only)
- Display help menu
Code:
./update.sh --help
Usage:
--help (-h) : This menu
--latest (-l) : Latest AMX MOD X version
--update (-u) : Update files
--auto (-a) : Autoupdates AMXX
--setup (-s) : Set up autoupdater
- Check latest version of AMX MOD X
Code:
./update.sh --latest
Latest AMX MOD X version
1.9 Build: 5270
1.10 Build: 5401
- Get latest version of AMX MOD X
Spoiler
Note: Executing the script with any parameters will output the help menu.
Code:
./update.sh --update
Please select the Game
1) Counter-Strike
2) Day of Defeat
3) Earth's Special Forces
4) Half-Life
5) Natural Selection
6) Team Fortress Classic
7) The Specialists
0) Exit
Number: (default: 1) : 1
// 1st window: Choose the game your server is currently running.
AMX MOD X Version
1) 1.9
2) 1.10
0) Exit
Number (default: 1) :
Before updating files, note that all modifications
of default files will be reset
Default files are shown below
configs / hamdata.ini
data / all default files
dlls / all default files
modules / all default files
plugins / all default files
scripting / all default files
Continue ? [Y/n] (default: Y) : Y
// 2nd window: Choose the AMX MOD X Version you wish to update to.
You can always change the version at any time.
Updating AMXX 1.9 Counter-Strike
## (10%)
#### (20%)
######## (40%)
########## (50%)
############ (60%)
############## (70%)
################ (80%)
################## (90%)
Replace specific files in configs folder ? [Y/n] (default: n) : Y
// 3rd window: You are asked if you wish to replace the local files
in the configs folder with the ones from the update
1) amxx.cfg [x]
2) clcmds.ini [replace]
3) cmds.ini [x]
4) configs.ini [x]
5) core.ini [x]
6) custommenuitems.cfg [x]
7) cvars.ini [x]
8) hamdata.ini [replace]
9) maps.ini [x]
10) miscstats.ini [x]
11) modules.ini [x]
12) plugins.ini [x]
13) speech.ini [x]
14) sql.cfg [x]
15) stats.ini [x]
16) users.ini [x]
Please select which files you want to replace or not
00) Continue | 88) Deselect All | 99) Select All | Number: 2
// 4th window: If you selected [Y] on the 3rd window,
in this window you select which files you want to update.
hamdata.ini is set as replaced by default.
e.g: selecting number 8 again will mark the file as X (to not replace)
typing "00" will Continue the setup
#################### (100%)
Successfully installed
NOTE: All files inside configs directory that were set as 'replace' can be found at addons/amxmodx/configs/backup folder
- Setup the autoupdater
Run ./update.sh --setup and specify the game that the server is currently running.
To setup the autoupdate the current version of AMXX must be either 1.9 or 1.10, which you can see it at ./compile.sh --version
If you get an error saying amxxpc does not exists then the only option is to update the game files using ./update.sh --update
The autoupdater loads a hidden file (addons/amxmodx/scripting/.save_data) that this file is created after successfully updating using ./update.sh --update.
The scripts checks if there's a new version and if so it automatically updates without user interaction.
Note: You must run --update then use --auto
- How to lauch autoupdater every server restart?
Firstly you need the .save_data file to load the configurations.
If you are missing the file, you can create one yourself or get it from updating the files: ./update.sh --update
If you are not able to use the terminal, you can create a dummy file and set the build version to a random number which will cause the autoupdater think that this is an old version and updated the files for you
Dummy file
The numbers in the configs are the files listed alphabetically, which 0 stands for 'to not replace' and 1 'to replace'.
The autoupdater will loop through each value and compare it with the files and decide if this file should be replaced or not.
After setting up .save_data modify the server start options as shown below: bash <gamemod>/addons/amxmodx/scripting/update.sh --auto && <your-current-server-start-script>
e.g: bash cstrike/addons/amxmodx/compile.sh --auto && screen -S server ./hlds_run -game cstrike -port 27015 +map de_dust2 +maxplayers 32 +sys_tickrate 512 +fps_max 512
Or your can run a side bash script to auto update
Note: Repacing modules meanwhile the server is running may cause the server to crash. screen -S autoupdate ./autoupdate.sh
Code:
autoupdate.sh >
#!/bin/bash
while [ true ]; then
bash cstrike/addons/amxmodx/update.sh --auto
sleep 24h # execute the script every 24 hours
done
How to use the commands?
If your server is running either 1.9 or 1.10, you can setup the autoupdater and run the autoupdate.sh script. ./update.sh --setup
If your server is on a older version, you can update to 1.9 or 1.10 and lauch the autoupdate.sh script. ./update.sh --update
Seems like a completely inappropriate place to put auto-update code for the entirety of AMX Mod X. I think that if something like this existed, it would need to be its own script since it's has absolutely nothing to do with compiling a plugin.