Syed Jahanzaib – Personal Blog to Share Knowledge !

September 16, 2011

Howto Create Counter Strike 1.6 Dedicated Server For LAN [with PSYCHOSTATS Ranking +MRTG System]

Filed under: General IT Related, Linux Related, Microsoft Related — Syed Jahanzaib / Pinochio~:) @ 2:18 PM


COUNTER STRIKE 1.6 DEDICATED SERVER INSTALLATION TUTORIAL [FOR Windows]

Counter-Strike is a first-person shooter GAME in which players join either the terrorist or counter-terrorist team (or become a spectator). Each team attempts to complete their mission objective and/or eliminate the opposing team. I created its first server back in 2006/2007 for my Ex-Cyber Cafe/Cable.Network system. Till date C.S is the most popular and famous networking Action Game for all ages.

I am writing this guide so anyone can create this server with very minimum knowledge required.

First you need to install Counter Strike 1.6 on any version of Windows . Either from CD or local installation file, Install it in

c:\cstrike

After installation, goto command prompt

cd C:\cstrike

Now use the following command to create CS dedicated server

hlds.exe -console -game cstrike -autoupdate +maxplayers 32 +map de_aztec +log on -nomaster +svlan 1

Or its better to create a new shortcut on your Desktop with the following code,

c:\cstrike\hlds.exe -console -game cstrike -autoupdate +maxplayers 32 +map de_aztec +log on -nomaster +svlan 1

This way you can always Start the server with this shortcut, or you can place it in your windows startup so it will automatically run when windows starts.

Now a Very basic counter strike dedicated server is ready to use. User can connect to this server and play game with each other.

Now We will add some extra functionalities in CS for enhancements and entertainment to give it fully professionaly look 🙂
For this purpose we have to add some MODs.

First we will ADMINMOd.

Goto

http://www.adminmod.org/index.php?go=downloads#am

and downlaod halflife-admin-2.50.60-win.zip

After downloading, extract it in any folder.

Run install_admin.vbs , click OK to continue,

Now it will ask you to specify a full path where CS is installed, in our case its c:\cstrike , so type the full path like this
c:\cstrike\hl.exe

It will ask Modification Choice, Select 1
It will then install ADMIN MOD.

Now if you will start Counter strike server, you will see few more lines indicating that [META] and [ADMIN] tags which will indicate that ADMINMOD is installed correctly. you can use the following  file to modify ADMINMOD settings at

C:\cstrike\cstrike\addons\adminmod\config\adminmod.cfg

For example you print your banner advertisement via this line
admin_connect_msg “Welcome to the AA Net CS Dedicated Server
and many other cool things you can do with this like map voting etc etc.

Always RESTART the C.S after adding any addon to it, so changes can take effect properly.

Now we will add another ADDON name AMXMOD. Installing AMX MOD X for counter strike is quite easy, Just follow these easy steps to install it.

A step bys tep GUI guide is available at

http://techgulf.blogspot.com/2011/03/how-to-install-amx-mod-x-for-counter.html 

Download AMXMOD 1.8.1 from

http://sourceforge.net/projects/amxmodx/files/AMX%20Mod%20X%20Full/1.8.1/amxmodx-installer-1.8.1.exe/download

The version of AMX MOD X which I am using in this guide is V1.8.1. Install AMX MOD X like you do  install any other app. Upon finish put check mark on “RUN AMX MOD X INSTALLER 1.8.1” and click on Finish.
Now a new window will apear,
Click on Next,
Accept the license agreement and click Next,
In Local Installation select “Select Mod directory” and click on Next,

Now it will ask you to choose directory, point it to c:\cstrike\cstrike\
and in Custom Game Addon, Select COUNTER-STRIKE from drop down menu, now click OK
It will then install the AMXMOD-X.

Now if you start the CS server, you will notice AMX MOD X tags in various lines.

Congrats You have install AMX Mod too 🙂 You can edit it according to your requirments.
Its config files locations are.

C:\cstrike\cstrike\addons\AMX Mod X\files\cstrike\configs

****   PSYCHOSTATS INSTALLATION TUTORIAL [FOR Ubuntu/LINUX]   ****


What is PsychoStats ?

PsychoStats is open source software that creates comprehensive gaming statistics for players and clans. Allowing anyone with a webserver to have a website that shows detailed statistics and ranks for their single game server, or even multiple game servers! for examples Half.Life and Coutner.Strike

A sample ranking website can be viewed at

http://pro-css.co.il/stats/index.php?sort=skill&order=desc&limit=100&q=&start=71100

PsychoStats version 3.1 is very easy and quick to install on any system. It includes an online installation wizard that you run through your browser. Follow these simple steps and you’ll be up and running in few minutes.

Minimum Requirements

- PHP v4.3 (or 5.0+)
 - MySQL v4.1.11 (or v5.0+)
 - Perl v5.8
 - Required Perl modules
 - DBI
 - DBD::mysql

If you have fresh Linux, install PHP , Mysql and other using this article.
https://aacable.wordpress.com/2011/09/15/howto-install-phpbb-forum-on-ubuntu/

Step By Step Installation Process of Psychostats:

Login as root to your linux machine.
Create a new temp directory

mkdir /temp
 cd /temp

Now download Psychostats 3.1

wget http://www.psychostats.com/downloads/PsychoStats/psychostats3.1.tar.gz

Untar it.

tar zxvf psychostats3.1.tar.gz

Now create a new directory in your webserver name stats

mkdir /var/www/stats

Copy the psychostats Frontend Files to above folder so that you can start web base installation process. To do this, use the following command

cp -rf upload/* /var/www/stats/

Now its time to create MySQL Databas before start the installation.
Exectue the msyql program and create the following database.
mysql -u root -p123

create database stats;
 grant all privileges on stats.* to root@"localhost";
 flush privileges;
 exit

Now its time to Start the installation wizard process 🙂 To start the installation point your browser to use a URL like this:

http://192.168.2.9/stats/install/index.php

Now follow the below images to go complete the installation.



Now Edit the /var/www/stats/config.cfg with the proper database settings that you have create above , so PsychoStats can connect to your database.

Sample :

root@linux:/var/www/stats# cat config.php

<?php
 $dbtype = 'mysql';
 $dbhost = 'localhost';
 $dbport = '';
 $dbname = 'stats';
 $dbuser = 'root';
 $dbpass = '123';
 $dbtblprefix =  'ps_';
 ?>

Now point your browser to http://192.168.2.9/stats and you will see Psychostats main screen.

Running PsychoStats

At this point you have run the ‘Install Wizard‘ from your browser and the database is fully setup and you can view your empty player stats online. Now it’s time to finally generate some stats!

First copy the stats.pl, stats.cfg and lib/ directory to the /var/www/stats from the folder where you untar the psychostats installation file. in this case it it /temp/

cd /temp
cp -R lib/ /var/www/stats/
cp stats.cfg /var/www/stats/
cp stats.pl /var/www/stats/ cd /var/www/stats

Now edit the stats.cfg and Enter the MYSQL DB details that we have entered before. Its necessary to run stats.pl correctly

Now execute the main stats.pl to generate your statistics.

./stats.pl -v

Note the added command line option ‘-v’. This enables ‘verbose’ mode and will cause some extra feedback while the stats are processing. This is recommended the first time you run it so you can see what is happening

Automatic Scheduling of PsychoStats

Now that you’ve run the stats.pl at least once and have confirmed that you are getting statistics on your website you’ll most likely want to setup PsychoStats to run automatically. PsychoStats does not have built in functionality to run itself. So in order to do this you need to add it in Linux CRON.

Run crontab and it will open up your default

crontab -e

Simply enter the following line

0,30 * * * * /var/www/stats/stats.pl

Save the file and exit. This will run stats.pl every 30 minutes

HOWTO CREATE MRTG STATS FOR FORCOUNTER STRIKE USER USAGE

As I am obsessed with MRTG, I have also found a way to graph Counter strike users. To graphs cs users, we will need a script name kkcron.pl ,
you can download it from http://kkrcon.sourceforge.net/after untar it , Now set the rcon password on your cs server by using this command on CS Server console.

rcon_password 12345678

Now test the kkcron.pl by following command to make sure its giving us the required data before going furhter.

/temp/kk/kkrcon.pl -a 192.168.2.5 -p 27015 -t new 12345678 status |grep players | cut -c12

(For some reason, you may have to adjust the cut -c12 integer to match yours, use some common sense in this matter) Result woule be some thing like below 17 (Which means 17 usesr are connected with your CS Server) Now everything is ready, use the Use the following cs.cfg example , that you can use to graph the C.S users with the help of kkcron.pl

#cs.cfg
# Total CS Users
Target[cs.users]: '/temp/kk/kkrcon.pl -a 192.168.2.5 -p 27015 -t new 12345678 status |grep players | cut -c12'
Title[cs.users]: CS Logged in Users
PageTop[cs.users]: <H1> CS Logged in Users </H1>
MaxBytes[cs.users]: 300
Colours[cs.users]: B#8888ff,B#8888ff,B#5398ff,B#5398ff
Options[cs.users]: gauge,nopercent,noo,integer,growright
LegendI[cs.users]: CS Logged in Users
LegendO[cs.users]:
YLegend[cs.users]: CS Logged in Users
Legend1[cs.users]: CS Logged in Users
Legend2[cs.users]:
Unscaled[cs.users]: ymwd
Counter Strike MRTG Graphs / aacable@hotmail.com

Counter Strike MRTG Graphs / aacable@hotmail.com

~!~ ALL DONE ~!~

Congratulations, You’re all done. You should have a fully functional Counter Strike 1.6 Dedicated Server for LAN with PsychoStats User Ranking System with MRTG installation and all will automatically update themselves.

Regard’s
Syed Jahanzaib

13 Comments »

  1. Thanks Jahanzaib bhai .I will try it

    Like

    Comment by faizan — September 16, 2011 @ 5:22 PM

  2. Sir, is there any way that only pay mikrotik pppoe users can play counter strike ? ? ?

    Like

    Comment by Aamirzia Charan — November 25, 2011 @ 4:42 PM

    • Place Counter Strike server in Mikrotik DMZ. Example.

      User LAN = 10.0.0.x/8
      PPPoE Users = 172.16.0.x/16
      CS Server behind Mikrotik DMZ = 192.168.2.2

      Add another LAN card in Mikrotik with ip address 192.168.2.1, and connected C.S with this Interface. Don’t place CS on user subnet. Add default gw on CS pointing to 192.168.2.1

      This way only pppoe connected users will be able to connect to it.

      Like

      Comment by Pinochio~:) — November 26, 2011 @ 10:29 AM

  3. can i do all th’is in cpanel with access ssh?user?plz help mee

    Like

    Comment by decomboy — June 22, 2012 @ 10:03 PM

  4. You’re in point of fact a just right webmaster. The site loading pace is amazing. It sort of feels that you’re doing any distinctive trick. Also, The contents are masterwork. you’ve done a magnificent process in this matter!

    Like

    Comment by CSS — September 21, 2012 @ 5:23 AM

  5. Hello
    Excellent post with excellent information. I really like Counter Strike.
    Dedicated Server

    Like

    Comment by Anjali — December 20, 2012 @ 2:36 PM

  6. Hi! Can you please help me with the mysql part. I am ready to pay you a couple of bucks for it.

    Like

    Comment by mahak — August 2, 2013 @ 3:27 PM

  7. what is the average bandwidth it needs…

    Like

    Comment by tamilmaran — November 24, 2013 @ 8:57 PM

  8. Strict Standards: Non-static method PsychoStats::create() should not be called statically in C:\xampp\htdocs\Game\stats\includes\common.php on line 102

    how i get rid this error?

    Like

    Comment by ARsalan — June 15, 2014 @ 2:11 AM

  9. when I write this link is prompt command ‘-game’ cstrike -autoupdate +maxplayers 32 +map de_aztec +log on -nomaster +svlan 1 i m getting an error like game is not recognized as an internal or external command, operateable program or batch file. erro plz tell me how to fix it

    Like

    Comment by Subhan Farooqui — August 28, 2014 @ 7:38 PM

  10. Nice

    Like

    Comment by joey — February 13, 2016 @ 4:41 AM


RSS feed for comments on this post. TrackBack URI

Leave a comment