Wiki

Clone wiki

HLstatsX Community Edition / Install

Introduction!

I have updated the wiki to make it alot more clear on installing HLX:CE on both Windows and Linux systems. Before we start please check the requirements page to make sure that HLX:CE will run on your set up.

This has been tested on Windows 7 & Debian Linux, if there is a work around that is needed please post it on the forums [http://forums.hlxce.com here]. And i will update the wiki to match the needed changes.

HLX:CE Set Up

HLX:CE is divided into a few parts. All parts are equally important to HLX:CE as a whole and will be explained below.

Step 1 - Download HLX:CE

The latest version of HLX:CE can always be found on our downloads page.

The cutting version of HLX:CE can be downloaded from the git repo

Step 2 - Uploading the Files

The zip or tar file you have first needs to be decompressed on windows you can right click on the file and extract. For Linux you can type the following

#!bash

    tar -jxvf HLXCE-1.X.X-FULL.tar.gz
Replacing the X's with the current version.

After you unzip the file you are going to see the following folders

  • amxmodx
  • heatmaps
  • scripts
  • sourcemod
  • sql
  • web

You will need to upload the web folder to your website. To check this go to http://example.com/stats/

If you are running Sourcemod on your servers then you need to go into the Sourcemod folder and add the plugin to your server. The same go's for AMXMod.

For the SQL folder you only need to upload the install.sql file, this does not have to be in the public folder but does need to be accessed from the command line // SSH

The last folder you need to have upload is the scripts folder, most of the time you are going to want the scripts AKA:Damon folder on the same server as the database, in 90% of cases this is going to be the website. For this folder it is extra important that people can not access this from the website. IE do not put it in the folder where you can see it in your browser. This is for security reasons.

Step 3 - Configuring the Website and daemon.

On the web server open the config.php with a text editor and fill out the needed data.

#!php

// DB_NAME - The name of the database
define("DB_NAME", "hlstatsx");

// DB_USER - The username to connect to the database as
define("DB_USER", "hlxuser");

// DB_PASS - The password for DB_USER
define("DB_PASS", "hlxpassword");

// DB_ADDR - The address of the database server, in host:port format.
//           (You might also try setting this to e.g. ":/tmp/mysql.sock" to
//           use a Unix domain socket, if your mysqld is on the same box as
//           your web server.)
define("DB_ADDR", "localhost");
Exit and save the file.

UPDATE REGARDING THE GOOGLE MAPS FEATURE

Due to a change done by Google, you now need an api key to use google maps, you CAN get a FREE api key, but they have a daily usage limit. If your hlstatsx ce website gets over 20-k hits in a single day, you might have to get a premium key, those WILL cost you REAL MONEY PER HIT! As a result, I HIGHLY recommend to ONLY get a premium key as A LAST RESORT! IT WILL COST YOU A LOT OF MONEY!! To get a free api key, go to https://developers.google.com/maps/documentation/javascript/get-api-key and follow the steps to get a key, once you get the key, go to your website files, go to the includes folder, and open the file named google_maps.php in a text editor, if you already have this file on your web host, you will need to use THEIR editor, OR edit the file locally and re-upload it. You want to look for the bit of code that says //maps.google.com/maps/api/js?sensor=false and replace that bit of code with //maps.google.com/maps/api/js?key=<REPLACE WITH API KEY>&callback=initMap but replace <REPLACE WITH API KEY> with your api key. Also, Google deprecated the sensor=false bit, so it can safely be removed.

The website part is done… for now!

For the deamon it is just another text file. Open the hlstats.conf file in the scripts folder with a text editor. Now fill the following.

#!php

# DBHost - Database server "address" or "address:port". Address can be an IP or
#          a hostname. The default MySQL port is 3306 (tcp).
DBHost ""

# DBUsername - User to connect to the database as.
DBUsername ""

# DBPassword - Password for the database user.
DBPassword ""

# DBName - Name of the database to use.
DBName ""

!!!!! NOTE !!!!! Read the rest of the daemon config and adjust Cpanel setting only if you can not get the daemon on to run with out it.

Step 4-Setting up SQL

Now we need to import the database,For this i am going to be showing the command line way for linux and windows, Thre are many GUI tools such as [http://www.phpmyadmin.net/home_page/index.php phpMy Admin] and [http://www.navicat.com/en/download/download.html Navicat] But because those require extra setup i will not be covering them. If you are running Cpanel you can also use this to import your DB instructions for that are [http://support.hostgator.com/articles/cpanel/how-to-import-your-mysql-database here]

Go to the folder where you uploaded install.sql and use the following command line to import the sql tables and config into your sql database:

#!bash
mysql -uhlxuser -phlxpassword hlstatsx < install.sql
A few seconds / minutes will pass and the SQL database will be filled with the required tables.

Note - Before you create the database it is recommended that you enable utf8mb4 encoding. This is because some players may have special characters that utf8 (The default encoding for MySQL) does not support. This has implications whereby, when importing logs for use in HLX:CE, a special character will cause the import to stop midway.

Step 5-Running the daemon

Because this differs so much from windows and Linux i am going to split this up covering both.

Linux

We need to make the following files executable:

#!bash
hlstats-awards.pl
hlstats.pl
hlstats-resolve.pl
run_hlstats

To do this we type the following

#!bash
chmod +x hlstats-awards.pl hlstats.pl hlstats-resolve.pl run_hlstats

Once we make the files executable we going to want to test that every thing is working. Type the following.

#!bash
cd path/to/scripts/folder
./run_hlstats start

You should now see on your screen something like this.

#!bash
HLstatsX:CE daemon control
http://www.hlxce.com
---------------------------
Attempting to start HLstatsX:CE daemon on port 27500...
Daemon successfully started on port 27500

If you see any errors here STOP and go back. Make sure you did not make a typo in your config files, also check the log folder inside the scripts folder there should be an log file with detailed errors.

After you have tested all that we now need to run the files every so offtion to make sure that every thing runs smooth. For this we are going to use cron jobs.

Before we get to the jobs them self lets lay out when we want the files to be run.

  • run_hlstat - We want to run this about every 5 mins to make sure the daemon has not crashed
  • hlstats-awards.pl - This needs to be run once a day other wise you will have no awards, This is also the script that translate ip's to locations and the general maintenance of the DB

Now that we have that setup we can enter our cron jobs. type the following then copy the code to fit your file locations.

#!bash
crontab -e

*/5 * * * * cd /home/user/scripts/ && ./run_hlstats start >/dev/null 2>&1
15 00 * * * cd /home/user/scripts/ && ./hlstats-awards.pl >/dev/null 2>&1

After you have done that you are set as far as all the scripts go.

While we are here there are some extras that will help you that only work in Linux as of this writing.

In the scripts folder there is a folder called GeoLiteCity in there you can make the file install_binary.sh executable then run it. This will update the file HLX:CE uses to get the location of an ip address.

If there are any errors in the log file and it's not working, yet you have no idea what it means. Post it at the hlstatsx forums! Someone is bound to help you there!!

Windows

  • First install perl, if you do not even know what perl is then just use ActivePerl Community Edition

  • Run the ActivePerl installer accepting the defaults. If you are not using ActivePerl then make sure the path to your perl install is in your PATH system var.

  • The following perl extensions need to be installed for HLX to run

    • MySQL DBI // DBD
    • Geo-IP PurePerl

If you are using ActivePerl then use the Package manger, else cpan has the packages.

  • Go to your HLX:CE folder, go to scripts and edit hlstats.conf

  • Now you want to test to make sure everything installed ok

    • Start -> Type "cmd" in the search with out " -> go to your hlx directory (if you need help go to line 0) -> go to scripts -> perl hlstats.pl

If no errors come up every thing went fine, now you want to set HLX:CE up as a service.

Thanks to psychonic this is made easy go HLXCE Serv to set that up.

You are done now with the daemon :D

Step 6-Configure HLX:CE

Next in line would be enabling and using all we've done above and wrap it up into running stats:

  • Website: Go to the website URL ([http://ip/stats http://yoursite/stats/]). Login as admin on the website (login url on bottom of page) Username: admin Password: 123456 Go to '''Admin Users'''. Make yourself a new user. Give it admin privileges. Delete the old admin user. Go to '''HLstatsX:CE Settings''' and edit the settings to your liking Go to '''Games''' and select the game you want the stats page to facilitate. You can do this by setting the dropdown menu for that particular game to '''show''' and all other games to hide. * Setting the above to the game you wish to host will unlock the '''Game Settings''' for that game. Click on this and then click on '''Quick-Add Server'''. Fill in all those required fields and hit the save button. This server will now be displayed on the main page as well.

Step 7-Configure Gameserver (server.cfg)

  • Logaddress. In order for the gameserver to send it's logs to the statsserver you need to enable logging and add a logaddress. This is usually done in the config file of the server (server.cfg) by adding '''log on''' and '''logaddress_add ip:port'''. *** Since our statsserver is hosted on the machine with IP <ip> and port 27500, we add the following lines to our server.cfg file: '''log on''' and '''logaddress_add ip:27500''' or for goldsrc games '''logaddress_add ip 27500'''.

  • Gold src games ++ cs ++ hl1mp ++ tf classic ++ dod

  • Rcon & Plugin The HlstatsX daemon communicates with the gameserver via rcon. Next to that it uses the hlstatsx plugin “talk” to the users via specific commands. Make sure that the rcon_password set on the server is the same password as used in the '''Game Settings''' on the website. To check if the plugin is correctly loaded (with sourcemod) type '''sm plugins list''' and look for hlstatsx in the list. Now join the server, wait for some players and see if the spam will start ingame :)

'''Note: For more information regarding ingame commands, please type 'help' in to the main chat window (defaultkey “y”) and read the windows contents!'''

Possible errors & solutions

https://forums.alliedmods.net/showthread.php?t=201556

If you are getting an error that is not covered in the FAQ feel free to create a post on the forums.

Thanks!!

Pfff, that was quite a job getting putting this manual together!

First I'd like to thank the following people:

  • '''Psychonic''' - ''For making such a damn great program and for taking up all my constant whining on steamfriends, like “Can you check it now?”, “How does it look so far?”, “Have you read it yet?”, “How about now?”, “When is the next version due?” and “I don't mean to be annoying… but can you check the manual?”''.
  • '''Bully''' - ''For being there most of the time during the day and read this manual''.
  • '''Bonzo''' - ''For giving the commands that should work under redhat/fedora and CentOS''.

Again, if there are any questions and/or comments regarding this manual, please post them on the hlxcommunity forum (or send me a forum pm there)!

Cheers for reading :) –Rawh

Updated