Outgun 1.0 server can be set to send information to a web script. That allows you to show some details of your server in a web site.
Write the script specific commands in the gamemod. The web_server command tells the hostname or IP address of the web server. You can have as many of those as you want. Outgun tries to connect to them in order until success. The script location in the server is also needed.
If you want to use the basic HTTP authentication in the submit script, also set a user name and password for that. The refresh interval is how often the game sends information to the script.
; List of the addresses for the web server, can be names or IPs.
web_server hostname.example
web_server 127.0.0.1
; Script path in the server.
web_script /example/submit.php
; Authentication if any (user:password).
web_auth user:password
; Refresh interval, in minutes.
web_refresh 2
; The web page of the server
server_website http://example.org/foo/outgun.php
The URL is used in a link in the web server list and in the server info message in the game.
You should make some kind of authentication in the web server to allow connections to the script only from your Outgun server. HTTP authentication is probably the easiest method for this. Outgun sends the user name and password in the correct header as Base64 encoded. If you can’t or don’t like to do HTTP authentication, you can check the name and password in your script.
If your Outgun server has a static IP address, you can make your script to only allow connections from that IP address. That can be made by the HTTP server or in the script. See Authentication in Apache 2.0.
The web script can be PHP, Perl, C++, C or anything as long as the web server supports it. The data is sent by POST method and as URL encoded. The script can do whatever you make it to do. You probably want it to save the data to a file and have another script to read and show some information to users. It is useful to respond something to the game server to see if the posting was successful. Outgun saves the response to log/web.log file.
Outgun server sends following parameters to the web script.
| Parameters sent on every update | |
|---|---|
| name | server name |
| ip | server IP address |
| port | server port |
| dedicated | sent if the server is dedicated |
| password | sent if the server has a password; this is not the actual password |
| players | human players on the server |
| bots | bots on the server |
| max_players | maximum number of players |
| version | game version |
| uptime | server uptime in seconds |
| map | title of the current map |
| mapfile | file name of the current map without .txt extension
|
| playerlist | list of the players, newline separated |
| powerups | sent if the server has powerups enabled |
| free_turning | sent if the server has free turning enabled |
| friendly_fire | sent if the server has friendly fire enabled |
| Parameters sent only at the first update | |
| maplist | list of the maps, newline separated |
| Parameters sent when the server is shutting down | |
| quit | server shutdown message |
There is one player on a line in the player list. On the line are the player’s name team ID (0 for red and 1 for blue) and ping (in milliseconds). These are separated by a tab character.
Player A<TAB>0<TAB>191
Player B<TAB>0<TAB>77
Player C<TAB>1<TAB>125
Player D<TAB>1<TAB>63
I have made a script system in PHP. I have three PHP files. submit.php saves incoming parameters to a outgun.txt file. huntta-server.php shows the saved information to users. Both files include server.php which contains the Server and Player classes.
Put index.php to any web directory you want to. Make there a directory called server. Put submit.php and server.php under the server directory. Give server/outgun.txt proper rights (group write), so the script can write in it.
Make HTTP authentication to server directory to prevent anyone and his dog submitting information. Write the same user name and password you used in authentication to website.txt in your Outgun config directory.
Now anyone can see the server information from huntta-server.php. Only your Outgun server can submit the information to server/submit.php.
If you want to get the map pictures work, make a directory maps and put the map pictures there. Notice that in my example the map pictures are named as mapname.png.
See the working example.