Counter-Strike 1.6 Dedicated Server. Mods.
Published: 2022-02-01 11:11:09

Hi everyone!
Welcome to the 2nd part of Counter-Strike 1.6 dedicated server series. Check out [Part 1 - Basic Setup](https://dev.to/flatmango/counter-strike-16-dedicated-server-part-1-basic-setup-33lf) where we set up a game server on VPS! This time we'll be discussing how to install mods to our newly created server so it will be more optimized and stable. Also we would install plugins (e.g. parachute, damage display) in future.

> **Disclaimer:** Only Steam users will be able to connect to our server. To make it possible for non-Steam users to play you have to install **Reunion** plugin which is not covered in this series.

To start tinkering with mods, stop the server:

```
./csserver stop
```

Let's create a `Resources` directory (anywhere on your machine) to store all downloaded resources for later use so we can easily refer to them.

## ReHLDS ([3.11.0.767](https://github.com/dreamstalker/rehlds/releases/tag/3.11.0.767 "ReHLDS 3.11.0.767"))

So first we need to install **ReHLDS**. In few words, **ReHLDS** is a result of reverse engineering of original HLDS (Half-Life Dedicated Server) using [DWARF](https://dwarfstd.org/doc/Debugging%20using%20DWARF-2012.pdf) debug info embedded into linux version of HLDS ([more details](https://github.com/dreamstalker/rehlds/blob/master/README.md "more details")). This will allow us to have more stable and optimized server with extednded API for adding mods and plugins. Open [release page](https://github.com/dreamstalker/rehlds/releases/tag/3.11.0.767 "release page"), download `zip` archive with compiled binary and unzip it to `Resources`.

Open `Resources/rehlds-bin-3.11.0.767/bin/linux32/` directory and copy all of its content to `/home/csserver/serverfiles/` directory on you server machine. Confirm if asked to replace.

## ReGameDLL ([5.21.0.540](https://github.com/s1lentq/ReGameDLL_CS/releases/tag/5.21.0.540 "ReGameDLL 5.21.0.540"))

It is a result of reverse engineering of original HLDS too which will provide us a more stable version of game with extended APIs for mods and plugins ([more details](https://github.com/s1lentq/ReGameDLL_CS/blob/master/README.md "more details")). Open [release page](https://github.com/s1lentq/ReGameDLL_CS/releases/tag/5.21.0.540 "release page"), download `zip` archive with compiled binary and unzip it to `Resources`.

Open `Resources/regamedll-bin-5.21.0.540/bin/linux32.` directory and copy all of its content to `/home/csserver/serverfiles/` directory on you server machine. Confirm if asked to replace.

## AMXX ([1.9.0.5294](https://www.amxmodx.org/downloads-new.php "AMXX 1.9.0.5294")) & Metamod-r ([1.3.0.128](https://github.com/theAsmodai/metamod-r/releases/tag/1.3.0.128 "1.3.0.128"))

Now it's time to install **AMXX**. Download [Linux version](https://www.amxmodx.org/amxxdrop/1.9/amxmodx-1.9.0-git5294-cstrike-linux.tar.gz "version for Linux") of the Counter-Strike package. Unzip it to `Resources` directory then copy `addons` directory from `Resources/amxmodx-1.9.0-git5294-cstrike-linux` to `/home/csserver/serverfiles/cstrike` on your server.

To finish **AMXX** mod installation we also ne to install **Metamod-r** - it's improved version of original **Metamod** made for Half-Life 1. **Metamod-r** is a plugin/DLL manager that sits between the Half-Life Engine and an HL Game mod, allowing the dynamic loading/unloading of mod-like DLL plugins to add functionality to the HL server or game mod. Open [release page](https://github.com/theAsmodai/metamod-r/releases/tag/1.3.0.128, download `zip` archive and unzip it to `Resources`. To install **Metamod-r** copy `Resources/metamod_1.3.0.128/addons/metamod` directory to `/home/csserver/serverfiles/cstrike/addons` on your server machine.

Let's finish **AMXX** installation. Navigate to `/home/csserver/serverfiles/cstrike/addons/metamod`. Create (if doesn't exist) a `plugins.ini` file. Open it and add the following line:

```
linux addons/amxmodx/dlls/amxmodx_mm_i386.so
```

Next navigate to `/home/csserver/serverfiles/cstrike/` directory and open `liblist.gam` file. Find all the lines starting with `gamedll `, remove them all and paste the following line:

```
gamedll_linux "addons/metamod/metamod_i386.so"
```

## ReAPI ([5.21.0.248](https://github.com/s1lentq/reapi/releases/tag/5.21.0.248 "5.21.0.248"))

We're done with **ReHLDS**, **ReGameDLL**, **AMXX** and **Metamod-r**. Next one is **ReAPI** ([repo](https://github.com/s1lentq/reapi/tree/5.21.0.248 "repo")). It is a module for **AMXX** that works with **ReHLDS** and **ReGameDLL** to extend existing APIs. Open [release page](https://github.com/s1lentq/reapi/releases/tag/5.21.0.248), download `zip` archive with compiled binary and extract it to `Resources`. Then copy content of `Resources/reapi-bin-5.21.0.248/addons/amxmodx/modules/` directory to `/home/csserver/serverfiles/cstrike/addons/amxmodx/modules/` on your server machine.

## Testing the server 

### Loaded plugins list

Done. At this point we added/installed all of the required libraries/mods. You should be able to start your server `./csserver start` with no errors and connect to in via game console `connect <YOUR SERVER IP>` or Servers window in the game client. I will not see any changes but there're changes. Go to the server terminal, open server logs:

```
./csserver console
```

Now, since we installed **Metamod-r** (which is kind of plugin/DLL manager as we mentioned above), `meta` commands are available and we can check loaded plugins:

```
meta list
```

This will show you a list of currently loaded plugins:

```
Currently loaded plugins:
      description  stat pend  file                vers         src  load  unload
 [ 1] AMX Mod X    RUN   -    amxmodx_mm_i386.so  v1.9.0.5294  ini  Start ANY  
 [ 2] CSX          RUN   -    csx_amxx_i386.so    v1.9.0.5294  pl1  ANY   ANY  
2 plugins, 2 running
```

### Server side commands

If you want to see list of available server administration commands (came from **AMXX**) type:

```
meta cmds
```

You'll see that you can kick/ban/unban players, start voting, change/extend maps etc. This is cool, but it's not comfortable when you're playing with your friends on your server. Cuz you have to switch from the game to the server terminal every time you want to use a command. So it would be handy to set your Steam user to admin so would use server administration commands in the game client console instead.

### Setting up admins and client side commands

Navigate to `/home/csserver/serverfiles/cstrike/addons/amxmodx/configs/` on your server machine and open `users.cfg`. It has quiet description comments so read them carefully. To be short, connect to your server via game client using Steam account you want to be admin. In the server terminal you'll see a message that some user just connected, like:

```
"YOUR_CS_NAME<1><STEAM_0:1:YOUR_SETAM_ID><>" connected, address "YOUR_IP_ADDRESS:PORT"
```

Copy that `0:1:YOUR_SETAM_ID` and add the following line to the end of `users.cfg` file:

```
"0:1:YOUR_SETAM_ID" "" "abcdefghijklmnopqrstuv" "ce"
```

Every single letter in these `"abcdefghijklmnopqrstuv"` and `"ce"` are access and account flags respectively, read more about them in `users.cfg` file comments and leave only flags you need.

Restart your server:

```
./csserver restart
```

Reconnect to the server via game client, open logs on the server terminal `./csserver console`. Now, every time you connect you'll see that you became an admin:

```
"YOUR_CS_NAME<1><STEAM_0:1:YOUR_SETAM_ID><>" connected, address "YOUR_IP_ADDRESS:PORT"
[admin.amxx] Login: "YOUR_CS_NAME<1><STEAM_0:1:YOUR_STEAM_ID><>" became an admin (account "STEAM_0:1:YOUR_STEAM_ID") (access "abcdefghijklmnopqrstuv") (address "YOUR_IP_ADDRESS")
```

From that moment you'll be able to use administration command directly in the game console. Switch back to the game client, open console and try some menu commands, like:

```
amx_kickmenu
amx_banmenu
map_menu
```

When any of this command executed, close console and you'll see appropriate menu with items users/maps listed to choose from.

I think that's it for now. At this point you have a clean CS 1.6 server ready for further customization. In the next part we'll cover plugins installation and compilation. Extend this tutorial by commenting, share with your friends and have a good game!

___

## Bonus

## Map menu

In previous part of the tutorial mentioned that map cycle can be set by changing `/home/csserver/serverfiles/cstrike/mapcycle.txt` file. But this is how maps will cycle *automatically* one by one and this has nothing to do with the list of maps you can choose from when using `amx_mapmenu` command. To change that list of available maps open `/home/csserver/serverfiles/cstrike/addons/amxmodx/configs/maps.cfg` file and put your map here.

## More interesting variables

Upon **ReGameDLL** installation process we also added additional config file with dozens of interesting variables to play with. It is `/home/csserver/serverfiles/cstrike/game.cfg`, take a look at it. Here you'll be able to set auto team balance, max money amount, grenades damage multipliers, specific weapons for T and CT and a lot of other stuff ([more details](https://github.com/s1lentq/ReGameDLL_CS/blob/master/README.md#configuration-cvars)).

Note that you've to restart your server of change/reload map for that changes to be applied.