Monday, June 14, 2010

Make Server Game C.S


Getting the files we need
First of all, we need to create a home directory for the dedicated server. Login as root and type this in the console:
# mkdir /usr/hlds
# cd /usr/hlds
Next, download the files:
# wget http://storefront.steampowered.com/download/hldsupdatetool.bin
# wget http://heanet.dl.sourceforge.net/sourceforge/metamod/metamod-1.19-linux.tar.gz
# wget http://heanet.dl.sourceforge.net/sourceforge/amxmodx/amxmodx-1.75a-base.tar.gz
# wget http://heanet.dl.sourceforge.net/sourceforge/amxmodx/amxmodx-1.75-cstrike.tar.gz
Installing HLDS
Presuming your current directory is /usr/hlds, you have to uncompress the hlds update tool:
# chmod +x hldsupdatetool.bin
# ./hldsupdatetool.bin
If you get the “sh: uncompress: command not found” error, type this and then start over the last two commands:
# ln -s /usr/bin/gunzip /usr/bin/uncompress
After the uncompress action completed successfully, there should be a new file named ’steam’. Start the server installation typing the command:
# ./steam -command update -game cstrike -dir .
If the bootstrapper was updated, you have to run the command again. Depending on your connection speed, the install process could take from a few minutes to a few hours. The installation size is about 200MB. When the process is finished successfully, the following message will be printed:
HLDS installation up to date
Configuring HLDS
The HLDS configuration is made through cvars. Cvars are variables that affect how your server is viewed and played. The HLDS cvars sit in a file called server.cfg. Here is an example of a server.cfg holding the minimum configuration cvars and here is the list of all cvars with descriptions.
MetaMOD Installation
Create the directories needed by MetaMOD typing these commands:
# mkdir /usr/hlds/cstrike/addons
# mkdir /usr/hlds/cstrike/addons/metamod
# mkdir /usr/hlds/cstrike/addons/metamod/dlls
Go to dlls directory:
# cd /usr/hlds/cstrike/addons/metamod/dlls
Extract the archive downloaded earlier:
# tar xfz /usr/hlds/metamod-1.19-linux.tar.gz
You should now have a file called “metamod_i386.so” in the “dlls” directory.
Next, you have to ‘tell’ the HLDS you’re about to use metamod as your game dll. This is done by editing the file /usr/hlds/cstrike/liblist.gam using a text editor (of your choice). In that file you should see the line:
gamedll_linux “dlls/cs_i386.so”
which you have to replace with:
gamedll_linux “addons/metamod/dlls/metamod_i386.so”
AmxMODX Installation
Go to the cstrike directory and type the following commands:
# cd /usr/hlds/cstrike
# tar xfz /usr/hlds/amxmodx-1.75a-base.tar.gz
# tar xfz /usr/hlds/amxmodx-1.75-cstrike.tar.gz
You should now have a new directory named “amxmodx” inside the /usr/hlds/cstrike directory.
Next, you must “tell” MetaMOD you are going to use the AMXModX plugin:
# echo “linux addons/amxmodx/dlls/amxmodx_mm_i386.so” > /usr/hlds/cstrike/addons/metamod/plugins.ini
Minimal AMXModX Configuration
The AMXMODX configuration is pretty straightforward and it’s made through the files inside the /usr/hlds/cstrike/addons/amxmodx/configs directory. Every file has its own cvars which are explained in detail so there shouldn’t be any problems.
Creating users with access on your server
You can assign a username and a password to certain people which are going to administer your server. They are added in users.ini in the same configs directory. For example, if you add and admin with username “Player” and password “123″, that admin has to type in his game console before connecting to your server:
name Player
setinfo _pw 123
The “_pw” string can be modified in amxx.cfg next to “amx_password_field” cvar. If, for example, you change the “_pw” string to “_whatever”, then the player has to type “setinfo _whatever 123″ before connecting to your server.
Add statistics and events
This is an optional step and you should do it if you want certain statistics and events being printed to every player’s screen during the game. Among many others, the statistics show the most disruptive player and team for every round, how much damage one’s made to the other, how much did he take and so on. This plugin is called StatsX and can be enabled editing modules.ini and plugins.ini:
modules.ini
Open it up with a text editor and uncomment (remove the; at the beginning of the line) the following line:
csx_amxx_i386.so
plugins.ini
Open it up with a text editor and uncomment the following lines:
statsx.amxx
miscstats.amxx
stats_logging.amxx
You can choose what events are enabled or not using the in-game stats config menu. For this, you have to add an account with maximum access to users.ini file, join the server with that account and type the following command in the game console:
amx_statscfgmenu
The complete AMXModX commands and cvars list can be found on AMXModX official homepage, under the DOC section. The list is way too large to be added to this tutorial.
Starting the server
Change directory to /usr/hlds and type the command:
# cd /usr/hlds
# ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2
If you want to run the server in the background, you have two options:
Normal
# ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2 > /dev/null 2>&1 &
This will launch the server in the background, sending the output to /dev/null. The good thing about this variant is that you don’t need any additional software installed. The bad thing is that you can’t attach to it later and make live modifications to it. If you want to see what is happening while the server is running, replace /dev/null with the name of a file (eg. hlds.log) or use the next run option.
Using screen
Presuming you already have screen installed and know a little about using it (detaching and re-attaching to it), start the server using the following command:
# cd /usr/hlds
# screen -A -m -d -S hlds ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2
To make the HLDS run at linux boot, just add the start-up command (with or without screen) to the /etc/rc.d/rc.local file. For example (using screen):
# echo “cd /usr/hlds” >> /etc/rc.d/rc.local
# echo “screen -A -m -d -S hlds ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2″ >> /etc/rc.d/rc.local
I hope you’ve found this guide helpful and have made an idea about how to create a Counter-Strike dedicated server with little effort. But this is just the beginning as there are many more things you can do and add to make your server an enjoyable gaming experience for you and those playing on it.
There are hundreds of addons and AMXModX scripts that customize and even radically change the gameplay on your server.
Have fun!

No comments:

Post a Comment