Tuesday, August 26, 2008

How To: Setting up a Dedicated Counter Strike Server on the Internet

Ok, this is where a lot of people get intimidated. Every other day I run into someone who is asking this question, and has little luck finding a simple answer. So I decided to do my own series of guides that would help people make better servers. First of all you need to get the ingredients.

The Game
Method One
First things first, you will need a copy of the game which would be the core of the server. If you have access to BitTorrent or are on a internet connection which disconnects often then you should download this torrent. What you require from this is the base game, plus the Add-on Pack. You do not need to download all of the files in the torrent.

Method Two
Optionally (and I prefer this), if you have a fast internet connection, which would be 512k or greater, then you should download this utility, and follow these simple steps:

  1. Create a folder on your hard drive and rename it to anything you want, like "Counter-Strike Dedicated Server" or something.
  2. Extract the above RAR file anywhere on your computer and double click on the installer.exe included in it.
  3. When the installer asks for the installation directory, simply choose the folder you created in step 1.
  4. After a couple of moments, a console window will open up and it will start downloading the Half Life Server files and Counter Strike. It takes about 30 minutes to complete on a 1 Mbps connection.
  5. After the installation is complete, verify that the size of the folder you created is between 310-320 MB. If its lesser, than re-run the installer, it will download the remaining files.
    Note: It usually takes twice to fully download.

  6. After the download is complete, you need to patch your server to work without steam. For this download this file. This is only required in case you want to run a non-steam server.
  7. Unzip the above file and place it in the Server's directory replacing the original files.

Getting the Game Online
No matter what method you followed from above, you now have a Half-Life Dedicated Server with Counter Strike ready to run on non-steam clients. However, it is configured to run on LAN right now instead of the Internet. To make it work online:

  1. Go to the installation directory, and open the cstrike folder.
  2. Look for a file called server.cfg and open it with any text editor like Notepad. This file contains all your server settings including the server variables (termed cvars onwards). So it is a good idea to tweak it.
  3. Replace all the text in it with the following code:


     

//Server Name
hostname "ACN-Clan.tk (Beta CS 1.6)"


//Match Settings
mp_autokick 0
mp_autocrosshair 0
mp_autoteambalance 1
mp_buytime .5
mp_consistency 1
mp_c4timer 30
mp_fadetoblack 0
mp_falldamage 0
mp_flashlight 1
mp_forcecamera 3
mp_forcechasecam 2
mp_friendlyfire 0
mp_freezetime 2
mp_fraglimit 0
mp_hostagepenalty 3
mp_limitteams 1
mp_logfile 1
mp_logmessages 1
mp_logdetail 3
mp_maxrounds 0
mp_playerid 0
mp_roundtime 3
mp_startmoney 800
mp_timelimit 30
mp_tkpunish 1
mp_winlimit 0


//Server Settings
sv_contact "uzairsajid@yahoo.com"
sv_region 6
sv_voiceenable 0
sv_aim 0
sv_airaccelerate 10
sv_airmove 1
sv_allowdownload 1
sv_clienttrace 1.0
sv_clipmode 0
sv_allowupload 1
sv_cheats 0
sv_gravity 800
sv_lan 0
sv_maxrate 7000
sv_maxspeed 320
sv_maxupdaterate 101
sys_ticrate 10000
decalfrequency 60
pausable 0
log on
decalfrequency 60
edgefriction 2
host_framerate 0
rcon_password yourpassword


//Additional Scripts
exec listip.cfg
exec banned.cfg

//plugins
bullet_damage 1
amx_bulletwhizz 1
amx_bulletwhizz_dis 35



I'll explain all the important cvars in a while, but for now just bear with me

  1. Goto your HLDS directory (Its the one you created initially, where you installed the server files) and right-click on the HLDS.exe. Select Create Shortcut and then open up the shortcut's properties. Click the Shortcut tab above.
  2. Now add the following at the end of the text in the Target box:


     

-console -game cstrike -ip localhost -port 27015 +exec server.cfg +maxplayers 4 +map de_dust2


For example, if you're HLDS is in G:\HLDS, then the field should be:

"G:\HLDS\hlds.exe" -console -game cstrike -ip localhost -port 27015 +exec server.cfg +maxplayers 4 +map de_dust2

  • -console enables the console and starts the server.
  • -game cstrike tells the HLDS to set the server type to Counter-Strike. This however could be any Half-Life MOD.
  • localhost should be replaced by you're IP address. Its a good idea to have a Static IP for a dedicated server, or if you have access to a DNS and are registered then place the domain name their.
  • -port is the default port for the server. Note that its a good practice to also forward that port to accept incoming connections.
  • +exec server.cfg tells the HLDS to execute the server side file first. In this case, its the server.cfg configured earlier.
  • +maxplayers 4 sets the maximum number of players allowed to 4. Its good practice to setup low number of players on test servers.
  • +map de_dust2 tells the server to start dust2 map.


 

  1. After you are finished with this step, you can double click on the newly created shortcut to start your server. You can also add this shortcut to you're system startup to autmatically start up everytime your system reboots.
  2. Congrats. You're basic Internet enabled Counter-Strike dedicated server is now ready. Join the game now and frag

Also note that this is just a basic server (MetaMod, AdminMod and StatsMe are installed in the backend but we are not using them) without additional features. Do comment about any suggestions or difficulties you had doing this. Next, I would post how to setup AMX Mod X (The King of Half-Life Server Side Scripting), HL Guard, and other cool plug-ins. Hope all this could help.