Dedicated Linux server extras

From TF2 Classic Wiki
Revision as of 19:17, 15 November 2022 by Sumea (talk | contribs)
Jump to navigation Jump to search

TF2 Classic SourceMod+Metamod Setup

Note: This guide was adapted and revised from a guide written by Raizo, the original of which can be found here: https://iraizo.github.io/tf2-classic-sourcemod-setup/

SourceMod+Metamod is powerful administrator tool for dedicated server owners and operators. SourceMod lets you add administrators easily based on SteamID, control and authenticate to the server securely and even add additional functionality to everyone on server like extended map voting functionality.

SourceMod isn’t necessarily drag-and-drop like supported SM games are such as live TF2 and CS:Source due to this simply being a mod built off of Source SDK 2013 with things like a different game name (tf2classic), offsets, signatures, etc.

While the process of getting SM to work isn’t that hard, generic source server guides do not cover few unique factors that come with setting up fully working MM+SM for mods like TF2 Classic.

Prerequisites

This guide assumes you already have a dedicated Linux server running that can run without issues, if not lacking in additional components. If not you should follow this guide to setup your server first.

This guide will use the same example install path as the main setup guide, so feel free to follow this guide directly if you did the setup guide too, or take not to reflect your own install path from the example one; /opt/tf2classic/server/.

Getting SourceMod and MetaMod

Visit the Stable builds section of sourcemod.net and grab the latest Linux build and upload it to your server using SFTP. If you do not have SFTP on your server, download it to your server using wget or similar tool.

Using Terminal or SSH instead of SFTP, first navigate to your server tf2classic folder, following example location from Dedicated Server Setup Guide, you would navigate to /opt/tf2classic/server/tf2classic/ first.
Then you can run wget to download SourceMod archive to your current directory:

$ wget https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6917-linux.tar.gz
This link may be outdated. You can check sourcemod downloads page for the newest version and copy the URL of newest build from there.

You’ll also need stable Metamod:Source. Download it with one of the ways you did.

$ wget https://mms.alliedmods.net/mmsdrop/1.11/mmsource-1.11.0-git1148-linux.tar.gz
This link may be outdated as well. You can check metamod:source downloads page for the newest version.

you can now extract both inside your tf2classic folder:

$ tar -xf sourcemod-1.11.0-git6917-linux.tar.gz
$ tar -xf mmsource-1.11.0-git1148-linux.tar.gz

You can delete the archive files after the extracted files are in correct place.

$ rem sourcemod-1.11.0-git6917-linux.tar.gz
$ rem mmsource-1.11.0-git1148-linux.tar.gz

Replacing metamod.vdf

Correct metamod.vdf is necessary for your server to recognize the game. Since this is a third party mod, we need to use a web tool to generate a custom metamod.vdf file that points to tf2classic, or create one manually ourselves.

You should navigate to your ../server/tf2classic/addons/, following Dedicated Server setup guide's example, we should navigate to: /opt/tf2classic/server/tf2classic/addons/

You can now delete metamod.vdf and metamod_x64.vdf in this directory. No need to back up these or anything.

$ rem metamod.vdf
$ rem metamod_x64.vdf

Head over to sourcemm.net/vdf. You’re going to leave the “Game:” blank, or as “—”. In the “Game Folder” box, enter tf2classic. After downloading generated file with these variables, use SFTP to transfer it to your server's ../server/tf2classic/addons/ directory.

If you currently do not have SFTP available on your game server, you can alternatively do everything from Command Line/SSH.

Make sure that you are working in ../server/tf2classic/addons directory.

First create a metamod.vdf file in this directory with following command:

$ touch metamod.vdf

Followed by opening the file in your favorite command line text editor, nano in this example:

$ nano metamod.vdf

And type in the following to this blank file:

"Plugin"
{
	"file"	"../tf2classic/addons/metamod/bin/server"
}

before saving and exitting.

Importing custom gamedata

To fix many functions of SourceMod when running under Team Fortress 2 Classic, we need to import custom gamedata.
Move first to work under ../server/tf2classic/ directory (/opt/tf2classic/server/tf2classic/)

If you are working with Ubuntu Server, you might have git program already installed. Try first the following command:

$ git clone https://github.com/Scags/TF2Classic-Tools.git

If you do not have git, download this repo with wget directly:

$ wget https://github.com/Scags/TF2Classic-Tools/archive/master.zip

Then unzip it:

$ unzip master.zip

cd into the directory, being either TF2Classic-Tools or TF2Classic-Tools-master depending on how you downloaded it.
Run the following command to copy sourcemod directory to your server's addons folder:

$ cp -r sourcemod/ ../addons/

Now we have the necessary gamedata for plugins and core SM and MM functions to work with TF2C.

Setting yourself as the “root” admin user and finalizing.

To register yourself as an administrator on your server with SourceMod, we have to add people to admins_simple.ini file.

You want to find out your SteamID using a website like steamid.io. Enter your steam community URL to the site and you should get set of info that includes your steamID, which should be in STEAM_0:1:16 format.

Open the file /opt/tf2classic/server/tf2classic/addons/sourcemod/configs/admins_simple.ini with a text editor, nano already familiar candidate. The file will be full of guidance and additional information how the file works for new users inside slashes. Do not worry about leaving all of it into the file as every line beginning with number of slashes are simply ignored, so this full looking file is empty as it comes to how SourceMod handles it. Punch a new line at the bottom of this file and enter the following:

"STEAM_0:1:16"		"99:z"

Replace STEAM_0:1:16 with your own or your master administrator's steamID that you extracted with afformentioned steamid.io for example. "99:z" in this case assigns high umminity and root (full) access for administration. You can add more people to admins_simple.ini file but you should limit their access to the server by using examples within the file itself and documentation from SourceMod's wiki: https://wiki.alliedmods.net/Adding_Admins_(SourceMod)

Save, exit and start/restart your server and everything should be running fine. You can make sure of this by typing meta version in your server console (or RCON). You should see a line like "Loaded As: Valve Server Plugin.". Additionally, if you assigned yourself as an administrator for the server, typing !admin or /admin in chat should bring up administrative menu on player hud. sm_admin should additionally work when typed in to your client console window, and you can use sm_rcon to use SourceMod to relay any console command to the server, if you set yourself up with z flag.

Further tweaking of SourceMod to suit your needs is out of scope for this guide. You can get familiar with SourceMod's other functions and configuration in their wiki: wiki.alliedmods.net/Category:SourceMod_Documentation