Location: PHPKode > projects > NM Stats > INSTALL.TXT
How to install NM Stats


1. Web Server, we recommend Apache (http://httpd.apache.org/)
2. PHP - http://www.php.net/
3. MySQL Server - http://www.mysql.com/

NM stats is a union of three components:
1_ ioUrbanTerror patch for the server; we added a dump of the stats at every round finish and basic in-game admin commands.
2_ ServerMonitor; a log parser. It also fills the data base we all the game data.
3_ Web Interface; php web site. We are not web designers, it's the best we could do... :)

You can see NM Stats working @ http://www.ClanNM.com.ar/stats

1_ ioUrbanTerror Server Installation (linux only HOWTO, on win32 you'll have to figure it yourself out..but should be straight forward)

If you don't have a working instalation of the ioUrbanTerror Server, please reffer to the documentation by the authors.

If you already have a server running, you will need the ioUrbanTerrorServer Source files by woekele

grab the zip file here: http://ftp.snt.utwente.nl/pub/games/urbanterror/iourbanterror/source/complete/ioUrbanTerrorSource_2007_12_20.zip

unzip it, copy the included patch file ioUrbanTerrorSource_2007_NMSTATS.patch to the folder where you unzipped it and patch the sources:

patch -p0 < ioUrbanTerrorSource_2007_NMSTATS.patch

then move into the ServerSource Tree

cd ioUrbanTerrorServerSource 

Done! That would build a new dedicated server in ioUrbanTerrorServerSource/build/release-{arch}

copy the new ioUrTded.i386 (in my i386 arch) to your current game server installation.
You might want to backup your original ioUrTded binary.

Your current config will work just fine on the new executable but read on carefully:
Just keep in mind that the patch and the extra scripts included in NMSTATS will make use of your
"qconsole.log" logfile so using logfile "2" make it unbuffered so the bot commands and the stats parsing is done in real time.
If you ever used a service bot on a quake server you already knew this.

NOTE: I tried to make the patch as beautifull as i could, but it's obviously a quick hack/fix to the ioUrT source code.
The principles behind this release are "it works for me, should work for you" but use it under your exclusive responsability.
If your computer blows away, get's on fire or kills your kitten...it's up to you, don't blame us :)

2_ ServerMonitor Installation

* Unpack the included SM-Monitor.tar.gz file to a place of your like, i recommend unpacking it inside your server gamefolder for ease of use.

Something like this...


* Change to the SM-Monitor folder

* Execute the db_urtstats.sql script to create the data base. 

    mysqladmin create URTSTATS (this is the default Database name we used)
    then create a local user/password (reffer to the mysql manual if you are not sure about this one..)
    for example 
	grant all on URTSTATS.* to YOURUSER@'localhost' identified by 'YOURPASSWORD';

* Open the .../SM-Monitor/ServerMonitor.ini for configuration

    Complete the host and port to your Gameserver server
    Complete the host, port, username and password (last two using the info from the last step)
    Configure the rconpassword of your ioUrT server in "pass"
    Set the path to your q3console.log logfile
    Set a path for script logging, make sure it exists.
    This is not currently used, so you can skip it
    Set the values
    adminpass= the password you want to grant admin privileges ingame using the "\!addadmin" command.
    enable= 0 or 1 if you don't want to use the Bot, this won't affect the stats collection.
    chat_commands = 0 or 1 if you want to be able to issue any command using just chat and !command. Some 
                   admin commands will require you to do a \tell <yourself> !command wich might be cumbersome.
                   if it's set to 0, you'll need to prepend a "\" to the "!command", it won't be "chat".
                   So nobody will read your commands ingame. 
    geoip = 0 (disable), 1(php internal geoip) , 2 (external included wrapper). Safest should be 2.

Done! keep in mind the database user and password you just set, you'll need those later.

When you start all up, join the server, remember the adminpass you just set and do \!addaddmin <yourslotnumber> [adminpass]
rejoin a team and you'll see your name if you do a !adminlist

3_ Web Interface Installation
Unzip the urtstats_web_interface file to your web server directory. 
Edit the /db/dbconnect.php and /globals/globals.php files.
* globals.php - Sections:
	- Main Title
		$GameServerIP = Public IP of the game server
		$GameServerPort = Port of the game server
	- qStat
		$GameServerIP_LAN = LAN IP of the game server, if not on lan use public IP
		$tmpdir = temporal directory
		$qstatbin = qstat binary path and filename
	- Directories
		$mainDir = name of the directory containing the site, Default: 'stats'
		Rest shouldn't be modified
* dbconnect.php:
	host, user and password to connect to the MySQL Server.
	URTSTATS is the default name of the databse.

4_Starting up

I made a simple script to start-up everything, since the SM-Server logs parser needs to be restarted
on every server restart.

It's just an example, tailor it to your needs, it uses the "screen" utility. and it relies 

-----------------START SVURT-START.sh------------
while [ true ]
process=`/bin/pidof /home/fun/urbanterror/ioded.svr1`
    if [ -z "$process" ]; then
        NOW=`date +"%T"`
#       mv /home/fun/urbanterror/gameservers/urt/q3ut4/qconsole.log /home/fun/urbanterror/gameservers/urt/q3ut4/qconsole.bak.$NOW
        cat /home/fun/urbanterror/gameservers/urt/q3ut4/qconsole.log >> /home/fun/urbanterror/gameservers/urt/q3ut4/qconsoleFULL.bak
        cd /home/fun/urbanterror
        screen -d -m -S URT /home/fun/urbanterror/ioded.svr1 +set dedicated 2 +set fs_homepath "/home/fun/urbanterror/gameservers/urt" +set sv_pure 1 +set com_hunkmegs 256 +set fs_game q3ut4 +set net_port 27960 +set ttycon 1 +set bot_enable 0 +exec server.cfg
        cd /home/fun/urbanterror/SM-Monitor
        pkill -9 SM-Server
        sleep 3
        screen -d -m -S PARSER ./SM-Server.php
        cd /home/fun/urbanterror
        echo "done"
    echo "Crashed" `date` >> /home/fun/urbanterror/gameservers/urt/q3ut4/crashlog.txt
sleep 5
-----------------END SVURT-START.sh------------

Return current item: NM Stats