HLDS Guides for Newbies
Created by Vadakill
 
Introduction

This guide will walk you through setting up AMXmodX and NS: Territory. This guide assumes that your basic NS server is patched to the latest version and is working properly without any mods currently installed. If you do not yet have a working NS server please go back to the guides index and select one of the NS guides for setting up a basic server.
 
Downloading the Proper Files

Make sure you are logged in as your user account and in your home directory, then download the following file using lynx, elinks or wget:

AMXmodX:
amxmodx-1.01 Base Files (1.91 MB) - Location: http://voxel.dl.sourceforge.net/sourceforge/amxmodx/amxmodx-1.01.tar.gz
NS Module for 3.05 (51K) - Location: Check this ModNS.org post, you will need an account but it's worth it for the resource it provides.

MetaMod:
metamod-1.18p24-linux-i686.tar.gz (64K) - Location: http://voxel.dl.sourceforge.net/sourceforge/metamod-p/metamod-1.18p24-linux-i686.tar.gz

NS: Territory:
NS Territory Required Files (84K) - Location: http://www.cc-br.com/ter/required.zip
 
Extracting the core AMXmodX files

This section covers extracting the AMXModX files properly in the correct locations. Configuration will come later, right now we just need everything in the right places:
 
Extract the AMXModX to the NS server folder. The command will untar the AMXModX file but before doing so it will change to the /home/hlds/hlds_l/ns directory before carrying out the command.
 
Code tar zxvf /home/hlds/amxmodx-1.01.tar.gz -C /home/hlds/hlds_l/ns

 
Extracting the NS module for AMXmodX

AMXmodX needs a special file in order to know how to hook into NS engine. It provides some functions that are specific to NS alone. We need this module in order to run AMXmodX with NS and therefore we need it for NS:Territory as well.

While NS:Territory comes with this already it is best to have the latest version in order to support some other plugins you may want to run. If you don't plan on running any other plugins for NS, you can probably skip this step completely.
 
Code unzip /home/hlds/amxxnsmodule305.zip -d addons/amxmodx/modules/

 
Extracting the Required NS:Territory Files

Now we will extract the NS:Territory script files to their proper locations. Compiling the script and configuring it will come later in the this guide, so don't worry about that for now.
 
Extract the NS:Territory required files to the AMXmodX folder. This command is similar to the tar command above, Due to the way the files were zipped, the correct procedure is to extract them into the /home/hlds/hlds_l directory.
 
Code unzip /home/hlds/required.zip -d /home/hlds/hlds_l/

 
Extracting MetaMod Files

This will help you create the directory structure for metamod and extracting the files in the proper locations; configuration files will be covered later in the guide.
 
First let's create the directory structure for the MetaMod program and config files. Normally if you tell mkdir to create a directory inside a directory that does not yet exist it will fail and give you an error message. The "-p" switch to the mkdir command creates all the parent directories needed in order to create the "dlls" folder. This means that mkdir first creates the "metamod" folder and then it creates the "dlls" folder that lives in it.
 
Code mkdir -p addons/metamod/dlls

Now extract the MetaMod files in the proper location:
 
Code tar zxvf /home/hlds/metamod-1.18p24-linux-i686.tar.gz -C addons/metamod/dlls/

 
Getting Familiar with "VI"

For most of the configuration we will be using a text editing tool called "vi". Vi can be difficult to use at first but you will quickly get used to it. Some simple commands to get you started:
  • To escape or turning off any mode you are in you can just hit the ESC key twice.
  • You can move to various places in the document using the arrow keys. Make sure you are out of any other mode first by pressing ESC key twice.
  • To begin typing information press the "i" key until an "--insert--" appears near the bottom of the screen. Hit ESC to get out of this mode.
  • To delete a single line make sure your out of any other mode by hitting "ESC" and then type "dd"
  • To delete 10 lines, make sure your out of any other mode by hitting ESC and then type "d10d"
  • To go to the beginning of your file type "gg", to go to the end hold down SHIFT GG
  • To go to a specific line do SHIFT G, the line number then SHIFT G again.
  • To undo the last mistake you made do ":u"
  • To save your file and quit vi do, SHIFT ZZ
  • If you made a lot of major mistakes and you want to quit without saving your file, do ":q!"
Configuring the liblist.gam file to load MetaMod

Ok, now we need to start doing a little bit of modifying to some configuration files in order to get this to run properly. One of the first things we need to do is change the original liblist.gam file so it loads MetaMod instead of the normal NS binary. You should still be in the /home/hlds/hlds_l/ns when doing these commands.
Edit the liblist.gam file in your ns directory:
 
Code vi liblist.gam

You will want to change the file so the section that looks like this...:
 
Code // Using HPB_bot support for now
gamedll "dlls\ns.dll"
gamedll_linux "dlls/ns_i386.so"

...will look like this:
 
Code // Using HPB_bot support for now
//gamedll "dlls\ns.dll"
//gamedll_linux "dlls/ns_i386.so"
gamedll_linux "addons/metamod/dlls/metamod_i386.so"

Good, once that's done do a "SHIFT ZZ" to save and close the file.
 
Configuring MetaMod to load AMXModX

Next is creating a file which tells MetaMod what plugins to load. The file is called plugins.ini and it is located in the addons/metamod folder. Let's create and add the appropriate lines:
 
Code vi addons/metamod/plugins.ini

Add the following line by hitting the "i" key and typing or pasting it in the file:
 
Code linux addons/amxmodx/dlls/amxmodx_mm_i386.so

Once that line is in there, save and close the file by hitting ESC twice and then "SHIFT ZZ".
 
Compiling NS:Territory Script into an .amxx Plugin

The NS: Territory plugin comes packaged as a source code ".sma" file. The source code itself can not be used to run the plugin, instead we must compile the plugin into a binary called a ".amxx" in order to run it. I'll walk you through compiling the plugin and moving it to the proper directory:

First we need to change to the directory where the territory.sma file and the compiler program are located:
 
Code cd addons/amxmodx/scripting

Then we need to execute the command to compile the .sma into a .amxx plugin:
 
Code ./amxxsc territory.sma

This will give you a territory.amxx file in the same directory as the .sma file. Now we need to move this file to the AMX plugins folder so AMXModX can find it when we tell it to load it in a later step.
 
Code mv territory.amxx ../plugins/

Before we move on let's change back to our "ns" directory so we can use that as our base in the next section:
 
Code cd /home/hlds/hlds_l/ns

Great, we are done here. Let's move on.
 
Configuring AMXModX to load the proper Modules

Modules are sets of functions that are not not considered essential for AMXModX to run properly. Modules are used to extend the capability of AMXModX for those people that need specific functions but still allow other admins who might not need them to leave them off which may make their system run leaner.
We will be editing the AMXmodX modules.ini file to load the base files needed for NS:Territory like so:
 
Code vi addons/amxmodx/configs/modules.ini

What we want to do here us uncomment the modules that we need in order to run Territory on our system. The easiest way to do this in "vi" is to use the arrow keys to go to the very front of the line we want to uncomment and simply press the "x" key once to delete the ";" in front of the module name. For example we want to change this:
 
Code ; AMX Mod X Modules
; You can specify both linux & win32 modules here
; To enable a module, remove the semi-colon from the line

; ------------------------------
; Fun - provides extra functions
; ------------------------------
fun_amxx_i386.so
fun_amxx.dll
fun_amxx_amd64.so

; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life
; ----------------------------------------------------
;engine_amxx_i386.so
;engine_amxx.dll
;engine_amxx_amd64.so

; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine
; ----------------------------------------------------------
;fakemeta_amxx_i386.so
;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so

...to this:
 
Code ; AMX Mod X Modules
; You can specify both linux & win32 modules here
; To enable a module, remove the semi-colon from the line

; ------------------------------
; Fun - provides extra functions
; ------------------------------
fun_amxx_i386.so
;fun_amxx.dll
;fun_amxx_amd64.so

; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life
; ----------------------------------------------------
engine_amxx_i386.so
;engine_amxx.dll
;engine_amxx_amd64.so

; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine
; ----------------------------------------------------------
fakemeta_amxx_i386.so
;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so

We aren't done yet, we also need to add the NS module that Territory needs. We are going to tack that onto the end like the following, I typed mine in but you can copy and paste what you see here if you want. Remember not to duplicate anything already in the file, just modify it so it looks more or less the same.
 
Code ; AMX Mod X Modules
; You can specify both linux & win32 modules here
; To enable a module, remove the semi-colon from the line

; ------------------------------
; Fun - provides extra functions
; ------------------------------
fun_amxx_i386.so
;fun_amxx.dll
;fun_amxx_amd64.so

; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life
; ----------------------------------------------------
engine_amxx_i386.so
;engine_amxx.dll
;engine_amxx_amd64.so

; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine
; ----------------------------------------------------------
fakemeta_amxx_i386.so
;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so

; --------------------------
; NS Module
; --------------------------
ns_amxx_i386.so

 
Once you are done with this you can push on to the next section.
 
Configuring AMXModX to load the NS:Territory Plugin

We are getting close to the end and to the point of actually firing up the server. We have only a few configurations left to do so let's get to it.

You remember earlier that we compiled the territory.sma file into a territory.amxx plugin and moved it into the proper position, one thing we didn't do though is tell AMXModX to load this plugin when it starts. That's what we will do next:
 
Code vi addons/amxmodx/configs/plugins.ini

Down on the bottom of this file there is a section that says "; Custom - Add 3rd party plugins here". Using your arrow keys go all the way to the bottom of this file and then press the "o" (letter "oh" not a zero) to append a new line. Once done type in territory.amxx so that it looks like the following:
 
Code ; Custom - Add 3rd party plugins here
territory.amxx

Once that change has been made, save the file and exit "vi".
 
Adding an Admin User to AMXmodX

One last thing we should do is add you as an admin on your AMXModX server. This requires you know your STEAMID so if you don't know it, log into any steam server and type status in the console. You should be able to pick out your name and STEAMID from the list. It looks something like "STEAM_0:0:123456".

Once you have that information do the following:
 
Code vi addons/amxmodx/configs/users.ini

In there under the loopback device type in the following so it looks like this, but with your real STEAMID instead of the dummy one in my example:
 
Code ; Examples of admin accounts:
; "STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce"
; "123.45.67.89" "" "abcdefghijklmnopqrstu" "de"
; "My Name" "my_password" "abcdefghijklmnopqrstu" "a"

"loopback" "" "abcdefghijklmnopqrstu" "de"
"STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce"

Now save the file and quit "vi". That's it, you should be done with all of the installation and configuration of your new NS:Territory server. Now we need fire it up and test it to make sure everything works.
 
Starting the Server

One thing you have to remember with NS:Territory is that it is a mod for NS:Combat; therefore only co_ maps have the proper configuration files needed to run "Territory" games. Keep thins in mind when you start up your server, make sure you start with a co_ map or change to a co_ map right after.

Start the server by using the following string:
 
Code screen -A -m -d -S ns ./hlds_run -game ns +maxplayers 14 +map co_core

By using screen you can attach and detach the screen from wherever you may be logged in. You can attach the screen by typing "screen -x ns" and hitting enter. You should now be able to see the server output. To detach the screen and have it go back to running in the background you would hold "CTRL" then press "a", then release "CTRL" and hit "d" to detach.
 
More Information

Once you've got your server up and running it is still a very basic and uncustomized system. You may need to change your mapcycle.txt file, want to add more plugins, change some custom messages you see and more. for that I suggest visiting the official AMXModX site and reading their Documentation. It explains a lot of things that I just don't go into enough depth with here.

Also, you may want to change how your NS:Territory server plays certain maps. You can find more information about modifying Territory's configuration files on their site which is found here.

Good luck with your new server, and please, if you found my guide helpful drop me an E-mail and let me know it helped you a lot. If you prefer to give monitary "thanks" you can drop me a few bucks on paypal by following the link below.

-Vadakill