6. Half-Life

Half-Life is the most popular multiplayer first-person shooter on the Internet as of this version of the HOWTO - mainly thanks to the modification Counter-Strike, hereafter referred to as CS.

6.1. System requirements

The system requirements vary depending on how many players you have on your server.

6.2. Installing

You need the HLDS (dedicated server) package to run a Half-Life server:

When you've downloaded the above file, create a directory for HLDS and run the downloaded file (specify $HOME/hlds as the directory to install to, if that's what you want):

$ mkdir hlds
$ sh hlds_l_3110_full.bin

Now we want hlds to see its dynamically linked libraries (*.so files). If you're running bash, which you most probably are, run:

$ export LD_LIBRARY_PATH=$HOME/hlds:$LD_LIBRARY_PATH

This adds $HOME/hlds to the directories ld checks for libraries in.

6.3. Configuring

Now you can start hlds; ./hlds_l to start a dedicated Half-Life server. It should work with the default settings, so try it:

$ hlds_l +maxplayers 12 +map crossfire

At the end you should see something like this:

WON Auth Server
 . . .
 

If the 'Auth' is missing it's probably because your server is using an incorrect IP address. Type status in the server console and it will spit out some info. If your IP isn't what it should be, quit the server with the exit command and start it again with this command:

$ ./hlds_l +ip xx.xx.xx.xx +maxplayers 12 +map crossfire

If it doesn't work now, you might be behind a firewall. If that's the case, let's just hope the network admin is friendly - make him open the port(s) you need. 27015 is the default port.

If you want to run a modification instead of regular DM or teamplay, pass the -game modname argument to hlds. Example: ./hlds_l -game tfc +maxplayers 12 +map 2fort.

The server reads autoexec.cfg, server.cfg, motd.txt and mapcycle.txt. Edit these to your liking. Autoexec.cfg is only executed when you start the server. Server.cfg is executed at every map change. Motd.txt contains the text that players will see when they join your server; a good idea is to put your server name, homepage (server stats page?) and contact info in it. Mapcycle.txt contains the list of maps you want rotated on your server. Type in all the maps you want there, each on its own line, without the ".bsp" extension.

Min/max rates - The commands sv_maxrate xxxx and sv_minrate xxxx force clients to use the specified rate. This is useful if you, for example, don't want LPB's stealing bandwidth (which makes HPW's annoyed) - type sv_maxrate 6000 to do this. If you on the other hand want to run a server for LPB's, set the minimum rate to something around 9000 with sv_minrate 9000.

Kicking/Banning - Each player is assigned an userid by the server. Type users in the server console to see the players id's. Usually you can kick people simply by typing kick nick, but this can be difficult if a client has a long nick or is using strange characters. If this is the case, you can kick clients by their id with kick # . If you want to ban a client, preventing them from coming back to the server, find their uniqueid with the users command and then ban with banid minutes uniqueid, where minutes is the number of minutes you want to ban the player (0 makes the ban permanent), and uniqueid the player's uniqueid. To keep players banned even after restarting the server, type writeid before you quit the server, and add exec banned.cfg to your server.cfg so that the next time you start your server, it will read the uniqueid's in banned.cfg. You can also kick and ban a client at the same time with banid uniqueid kick. Remove a ban with removeid id, and don't forget to remove it from server.cfg if it's there too.

RCON - RCON lets clients on your server execute server commands remotely. Add the line rcon_password "password" to server.cfg. Clients type rcon_password password in the console and can then execute server commands, like rcon kick, rcon mapchange, etc. This is good if you want to deal with abusive players directly when you're playing on the server, or maybe let a few other trustworthy persons do it. To use rcon when playing on your server, type rcon_password password in the in-game console. You can now execute several commands if the password was correct, but remember that you must add rcon before every command, for example rcon kick player.

6.4. Counter-Strike

First you need, of course, a working Half-Life server. Download the latest CS package. As of this revision of the HOWTO it's 1.5, but that may have changed when you read this.

Extract it to your HLDS directory:

$ tar zxvf cs_15_full.tar.gz -C $HOME/hlds

Now run the CS server:

$ hlds_l -game cstrike +maxplayers 12 +map de_dust

Edit the /usr/local/games/hlds/cstrike/server.cfg file to change it to your liking and optimize the server. The file mapcycle.txt contains the list of maps to be included in the map cycle, and motd.txt contains the MOTD - Message Of The Day.

Maps - By typing mp_timelimit 1 in the console, the server will go to the next map in the cycle. The command changelevel followed by the mapname makes the server change to the specified map. The maps must be in your cstrike/maps directory.

For more information on CS servers, see http://server.counter-strike.net.

mirror server hosted at Truenetwork, Russian Federation.