Half-Life
41 valoraciones
Starting a Dedicated Server
Por hiphopparappa
This guide will show you how to create a dedicated server for any GoldSource game, including Half-Life, Opposing Force, Counter-Strike, Ricochet, and other GoldSource mods.
Note: OPT. = optional section
   
Premio
Favoritos
Favorito
Quitar
I. Setting a Static IP Address
Before we begin, we need to set a static IP address to our computer. You need to download a program called Port Forward Network Utilities[portforward.com] to continue. Once it is installed, select the Static IP Address option in the menu. Select your network device in the drop-down menu and press the Make it Static button.
The reason why we are doing this is because if your IP address is still dynamic, it will keep changing every time you restart your PC and it needs to be the same.
II. Port Forwarding
Finding the Default Gateway
Before you get to the server part, you need to forward some ports on your router so that Half-Life Dedicated Server (the tool we're using) can use them, and clients from other networks can access those ports.
Open your start menu and type cmd and open the Command Prompt. Elevation is not required. In the command prompt, type the command ipconfig. A list of configurations for the network devices you have will appear. Find the one you're using, and get the address for your Default Gateway. Type that address in the URL bar of your browser. NOTE: make sure you keep CMD open!! We will need it later. You should have a prompt appear to type a username and password. Most routers have the username and password admin, but some people, like me, have the username admin and a password. You can go to your router and there should be a sticker showing the default gateway password (it isn't the one you use to connect to your router). If you can't find it, you should look around the house for any other things that came with the router, or contact your ISP.

Port Forwarding
Now, we can port forward! Find the page for port forwarding on your router settings. If you can't find it, your ISP should show you how on their website.
Using this page we can add "rules" to your router. Create one, [name it whatever you want] and enter the IP for your PC. In ALL the boxes where you can enter a port, type 27015 and select the TCP protocol and save the rule. Repeat the exact same step, but this time, use the UDP protocol. NOTE: you cannot use the "UDP/TCP" protocol. Repeat the same step again, but this time, type the port 27020. Make sure you keep the UDP protocol. Repeat the step again, but with the port 26900.
Now, you should be port forwarded!
III. Downloading Half-Life Dedicated Server (HLDS)
SteamCMD
You'd think you could just go into Steam Tools and download the tool from there, but for unknown reasons, that version of the tool is broken. You need to download SteamCMD to get the fixed version of the tool. Extract the ZIP to any folder you want [if you have multiple drives, save it to the one with the most space, 3 GB+ is recommended]. Now, you can open SteamCMD and wait for it to download all the files it needs.

Half-Life Dedicated Server
Once SteamCMD has finished downloading, you can sign in to your Steam account, though if you don't want to, you can try using the anonymous account.

Your account:
login <USERNAME>

Anonymous:
login anonymous

Once you're logged in, you can install Half-Life Dedicated Server (we will refer to it as HLDS from now on). In SteamCMD, type app_update 90 validate and it will begin downloading, then it will validate all the files. The download will suddenly stop, so type the command again until there are no more updates. Once it is finished, go to your SteamCMD folder, then steamapps, common, Half-Life.
IV. Setting up HLDS
Create a batch file in your HLDS folder. The batch file tells HLDS what settings to use. Name the batch file with the name of the game/mod of which you want to host a server for. You can create more batch files for different mods/games.

Format:
hlds.exe -console -game <game/mod folder> +maxplayers <2-32> +map <map> -ip <your ip> +port 27015
The -game variable is not required for normal Half-Life.

Example:
hlds.exe -console -game cstrike +maxplayers 32 +map de_dust2 -ip 192.168.1.1 +port 27015

If you want mods/other games, such as Counter-Strike, copy their folders from your Half-Life directory, which can be found by going to Half-Life's properties in your Steam library, LOCAL FILES and then BROWSE LOCAL FILES. Copy the mod/game folder to your HLDS directory.

Folder names
Half-Life: valve
Counter-Strike: cstrike
CS Condition Zero: czero
Deathmatch Classic: dmc
Opposing Force: gearbox
Ricochet: ricochet
007 Nightfire: nightfire
Gunman Chronicles: rewolf
Day of Defeat: dod
Team Fortress Classic: tfc
For mod folder names, play the mod, open the console and type gamedir
Tracking Your Progress
HLDS should be able to work at this point, though with only basic functions. Before we go any further, start your batch file for Half-Life and make sure you have your IP on your clipboard. Open Half-Life, open the console, and type connect <your IP> and you should be able to join. If it says STEAM validation rejected, close the server and run the batch file again.

If you're able to join the server, you now need to see if other people from other networks can join. Search "what it my ip address" or just "ip" and your public IP address should appear. You can send this to playtesters of the server and they should be able to join if you port forwarded correctly.

To shut down your server, do not simply close the HLDS window, otherwise players will just lose connection. Type quit in the server console and players will be kicked from the server before HLDS closes with the message "Kicked: server shutting down."
V. Configuring HLDS
In your HLDS directory, go to the game/mod folder you want to host for, and open server.cfg with Notepad. The default looks like this:
// Use this file to configure your DEDICATED server. // This config file is executed on server startup. // disable autoaim sv_aim 0 // player bounding boxes (collisions, not clipping) sv_clienttrace 3.5 // disable clients' ability to pause the server pausable 0 // default server name. Change to "Bob's Server", etc. // hostname "Half-Life" // maximum client movement speed sv_maxspeed 270 // load ban files exec listip.cfg exec banned.cfg

In this file you can change the server name, how fast players can move and add your own commands you want to run on server startup. It is recommended that you add // custom commands at the bottom of the file to enter your own commands. See section VII for a list of commands.

In ordinary deathmatch games such as Half-Life, Opposing Force, Team Fortress Classic and Deathmatch Classic, they have a mapcycle.txt file which allows you to change what maps you want in the server. After a match, the server uses that file to decide the next map. Plugins for AMX MOD X (see section VI) allow players to vote for the next map.
VI. [OPT] AMX MOD X
AMX MOD X is the plugin base for all servers that run on HLDS. I will not show you how to install and make your own plugins.
You can download it here[www.amxmodx.org] and in the installer, select Select Mod Directory and choose the game/mod in your HLDS directory that you want to host for.
VII. HLDS Commands
There are lots of handy commands in HLDS that you can use to make your server better. A lot of SV commands that work in Half-Life also work in HLDS, such as sv_airaccelerate. These commands can be added to your // custom commands section of your server.cfg file.

changelevel
Value: <mapname>
Function: Changes the map without kicking out all players.

maxplayers
Value: 2-32
Function: Changes the amount of players that can be in the server. Changes are applied on the next changelevel

sv_maxspeed
Value: 10-<no max>
Function: Changes how fast players can walk. Jumping may be slowed down due the the bunnyhop cap implemented into the engine in 2003.

hostname
Value: <your server name in quotation marks>
Function: sets the server name shown in server browser and leaderboard

sv_password
Value: <your password in quotation marks, with no spaces>
Function: Sets a password to the server. Players will need the password to connect to and join the server.

If you want more commands let me know in the comments.
VIII. Conclusion
You should now be able to run your own server. If you ran into any problems, let me know in the comments.
Thank you for reading this guide!
41 comentarios
"Youthful President" 23 NOV 2023 a las 9:11 a. m. 
Ok, thanks!
hiphopparappa  [autor] 20 NOV 2023 a las 12:11 p. m. 
Have a list of maps in mapcycle.txt in the valve or mod directory. In server.cfg set mp_timelimit to 10.
"Youthful President" 18 NOV 2023 a las 1:04 p. m. 
Question, is there a way to make the maps cycle automatically? Like every 10 minutes or so
mrmanager 18 NOV 2023 a las 7:24 a. m. 
Hey, so I'm trying to run this in an Ubuntu command line, but I keep getting this error:

[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
dlmopen steamservice.so failed: steamservice.so: cannot open shared object file: No such file or directory
FATAL ERROR (shutting down): Unable to initialize Steam.

Can anyone help?
hiphopparappa  [autor] 13 JUL 2023 a las 1:47 a. m. 
Most popular AMX plugins are years old and hasn't been updated to compensate new AMX versions and/or Half-Life versions.
Mangezz 20 JUN 2023 a las 6:58 a. m. 
i have tried 4 different ones.. really want blocks on it
hiphopparappa  [autor] 15 JUN 2023 a las 10:25 p. m. 
It's probably a broken plugin and you might have to go without it
Mangezz 14 JUN 2023 a las 1:48 a. m. 
i found the problem, its when i typ blockmaker.amxx in the plugin it wont start... any idea of how i can get blockmaker to it?
hiphopparappa  [autor] 13 JUN 2023 a las 8:16 p. m. 
The batch file needs to be in the same place as your hlds.exe file, not your Desktop.
Mangezz 13 JUN 2023 a las 8:15 a. m. 
I have followed the guide but when i try to start the batch file on my desktop it instantly closes.. any suggestion?