You are here

Part 5 - Setting Up HLstatsX

HLstatsX is a great player and server statistics tracking package. One of its community derivative now rivals the traditional commercial offering. I recommend HLstatsX Community Edition:

If are new at hosting your own CS:S servers, I strongly recommend skipping this step. This procedure requires the setup of a web server.

* A Note About HLstatsX and Web Hosting *

I've found that performance is best if you run HLstatsX and the game server on the same machine. The perl log daemon and MySQL server talk to each other quite a bit while the server has many players. If you are planning to do this, keep in mind that you will be using extra CPU cycles. Also, have extra upload on your internet connection if you plan on making the HLstatsX site public.

HLstatsX Community requires the following:

Apache -
Perl - [*Note: Install the DBD::mysql (dbd-mysql) module]

*Note: If you use Windows and the binaries, make sure to grab the Windows PHP VC9 x86 Thread Safe binaries. I lost quite a bit of time figuring this out.

Installing these services is beyond the scope of this guide. The following instructions assume you already have a working web environment.

*Note #2: I lost more time updating this for Windows Server 2008. Be careful with Windows Server 2008 networking - it likes to resolve localhost to ::1: (IPv6). I ended up using instead.

Step 1 - Extract the HLX Community zip files

Extract the zip file to your hlx folder (e.g. S:\hlx\27015\). You should see several sub-folders including scripts, sql, and web.

Step 2 - Setup the database for HLX Community

I use phpMyAdmin ( to administer my MySQL environment. In phpMyAdmin, login to your MySQL server and click the Privileges tab. Choose Add New User.

Type in the user name, assign the host scope (I pick localhost), and type in a password. Under the Database for user options I pick Create database with same name and grant all privileges. Click Go to create the user and database.

Step 3 - Import the HLX Community SQL script

Click on your new database on the left. Click the Import tab and browse to the HLX Community install.sql file. In my example this is S:\hlx\27015\sql\install.sql. Click Go to run the script. If run successfully you should see a whole bunch of tables on the left side of phpMyAdmin.

Step 4 - Import the latest GeoLiteCity data

HLX Community provides the capability to show players on a map on your website and also announcing a player's country when they join. Their location is always shown when you click through to them from the player list. HLX Community uses the freely-available GeoLiteCity data from MaxMind ( MaxMind updates their package once a month.

HLX Community has a Windows utility on their website called the HLX CE MaxMind GeoLiteCity DB Importer. I recommend downloading it and running it as often as you want the Geo IP data updated. Running the utility is as simple as opening a command prompt, running HLXCEGeoLiteImporter.exe, and following its directions.

Step 5 - Setup the web server files

Create a new sub-directory/sub-domain (e.g. hlstats) on your website and copy the files from S:\hlx\27015\web\ to it. Since this is a new install, remove the updater sub-directory.

Open up config.php and update the appropriate fields:

define("DB_ADDR", "");
define("DB_NAME", "hlx-27015");
define("DB_USER", "hlx-27015");
define("DB_PASS", "hlx-27015-password");

Once you save and close the file, your HLstatsX site should now by active. To access it, enter the correct URL in your web browser. For example:

The front page will display and empty Google map and a blank graph underneath it. You should see an [Admin] link at the bottom of the page.

Step 6 - Setup HLstatsX options

Click the [Admin] link at the bottom of the site. The default username is admin and default password is 123456

Once logged in, change the admin password immediately. Under General Settings click Admin Users and change the password field for admin. Click Apply to update the password. You will need to login again.

Next, click General Settings then HLstatsX:CE Settings. I personally change the following:

Site Name: HLstatsX
Site URL:
Show load summaries from all monitored servers: Hide

Google Maps Type: Normal
*Choose whether to use GeoCityLite data loaded into mysql database or from binary file GeoIP lookup via database

*Ranking type: Kills

*HLstatsX will automatically delete history events...: 180
If no (default), use the current time on the database server...: Yes
*Log admin chat to database: Yes

Click Apply to activate the changes. You can ignore the warning about restarting the perl daemon as we haven't started it yet.

While still under General Settings, click Games. You'll need to hide TF2 (by checking its Hide box) and unchecking the Hide box for CS:S. Click Apply to activate the change.

Step 7 - Adding your CS:S server

Navigate to Game Settings, Counter-Strike Source, then Add Server. While I understand we have yet to actually create a CS:S server, we can fill in all of the required information. I use the Strong Password Generator ( to generate a secure RCON password.

Server IP Address:
Server Port: 27015
Server Name: Your server name
Rcon Password: c6hciF4dK1VHz8EyF336V
Public Address:
Admin Mod: Mani Admin Plug-in

Click Add Server to complete the configuration. Once complete, you will now see the server on your main HLstatsX page.

Return to Game Settings, Counter-Strike Source, then click on Edit Servers. Click the Configure link on the right side of the server entry. I personally modify the following parameters:

ConnectAnnounce: 0
ShowStats: 0

As you mouse-over the different parameters you'll get a description in the top of your browser. Click Apply when complete.

Step 8 - Setup the HLX Community perl daemon

Navigate to the folder S:\hlx\27015\scripts\. Open up the file hlstats.conf with Wordpad. Update the appropriate options:

DBHost ""
DBUsername "hlx-27015"
DBPassword "hlx-27015-password"
DBName "hlx-27015"
BindIP ""

Save and close the file. Assuming you have installed perl correctly, you should now be able to double-click and run the perl daemon (i.e. HLstatsX itself).

Step 9 - Setting up a batch script to keep the HLX Community perl daemon running

While the programmers of HLstatsX work very hard and produce a great package (thank guys!), the perl daemon will sometimes crash. I use a simple batch script to restart the perl daemon after an abnormal termination:

@echo off
title 27500 CS:S STATS
echo (%date%)(%time%) STATS STARTED
echo ===============================================
start /DS:\hlx\27015\scripts /WAIT S:\hlx\27015\scripts\
echo (%date%)(%time%) WARNING: CRASH
goto perl

Step 10 - Setting up daily awards

Your HLstatsX site has a navigation button that leads to an awards page. Here you will find cheesy awards for things like "best latency" and "best with M3". These awards are generated daily, and can be generated anytime after midnight. For example, if you run the awards on 03/29 at 12:05, it will calculate the award winners for 03/28.

The perl script that generates the awards is called I use a Windows Scheduled Task that runs at 12:05am:

    Task properties
  • Run: S:\hlx\27015\scripts\
  • Start: S:\hlx\27015\scripts
  • Run As: Your limited user account
  • Schedule Task: Daily
  • Start time: 12:05am
  • Every: 1 day(s)
  • Stop the task if it runs for 23 hours and 0 minutes

Step 11 - Adding HLstatsX to your CS:S server's config file

Add the following lines to your server.cfg (created in the next step):

log on

I recommend you refrain from starting the HLstatX perl daemon until the rest of your server is setup and functioning correctly.