Server configuration
Available languages: Русский · English |
Installing SteamCMD
SteamCMD is a command line tool that makes setting up servers for Garry's Mod (and most other Source engine based games) very easy. You can download it for Windows and Linux from the Valve Developer Wiki.
Installing the Server (Windows)
To download and install your server enter the following script into command prompt or save it as a batch file (paste it into notepad, click "Save As..", set the "Save as type" to "All Files (*.*)" and append ".bat" or ".cmd" to the filename).
"PATH_TO_STEAMCMD\steamcmd.exe" +login anonymous +force_install_dir "PATH_FOR_SERVER" +app_update 4020 validate +quit pause
Running the batch file will start to download a Garry's Mod to the "PATH_FOR_SERVER" directory you specified. This process may take some time depending on the speed of your internet connection.
Creating a Collection
The most straightforward way to add mods to your server is to create a steam workshop collection. You can do this by navigating to the Garry's Mod Steam Workshop "Collections" section and clicking "Create Collection". When you've named and branded your collection head over to the Workshop pages for any of the mods you want to add and click "Add to Collection" then choose the name of your server collection. To install Metrostroi you add the following mods to your collection:
- Metrostroi (Subway Simulator)
- Metrostroi Subway Simulator - Content Pack part (1 to 6)
- Metrostroi Subway Simulator - Scripts
- A Metrostroi map you want to use (mostly listed here)
Installing Mods
Using command line arguments you can configure your server to automatically install/ update all of the items in a collection. Save the following script as a batch file in the same path as your Garry's Mod server is installed.
srcds.exe +maxplayers 20 -console +host_workshop_collection YOUR_COLLECTION_ID +gamemode sandbox +map NAME_OF_THE_MAP_YOU_WANT
You can find the names of most metrostroi maps here to replace "NAME_OF_THE_MAP_YOU_WANT".
Please note that the "gm_metrostroi_b50" has a lighting issue that may cause your server fail when starting up due to a "Engine hunk overflow!". To fix this add " +r_hunkalloclightmaps 0" to the end of your command line arguments.
If you have followed the above steps correctly you should now have a fully functional Metrostroi server. If you don't, for whatever reason, the Garry's Mod wiki has a more general (but more detailed guide) on how to set one up here.
Connecting to the Server
You should be able to connect to your server using the "LAN" tab in your Garry's Mod server browser or by using the "LAN" tab in the steam "Servers" window. If you use any form of firewall or your router has a built in firewall other players probably won't be able to connect to your server. To solve this you need to tell your firewall to allow certain network traffic though to your game server.
Do not complete the following steps unless you know what you are doing- adding firewall exceptions can make your computer and network less secure.
The exact process of adding "exceptions" to your networks firewalls depends heavily on what hardware/ software you are using. You are probably best looking up a guide of how to "Port Forward" on your specific router and how to add firewall exceptions to your antivirus. By default Garry's Mod will use the ports 27005 and 27015 (UDP and TCP) however if you choose to run more than one server at the same time you will need to unblock two ports for each server (eg 27006 and 27016)
Tips
Server.cfg
You can set the name, password, wagon limit and other important things by editing the "server.cfg" in "garrysmod\cfg". Below are some useful lines to put in this file:
- hostname "SERVER_NAME_HERE"
- metrostroi_maxwagons "WAGON_LIMIT_HERE"
- metrostroi_maxtrains "TRAIN_LIMIT_HERE"
- metrostroi_maxtrains_onplayer "MAX_TRAINS_PER_PLAYER_HERE"
A more extensive list of console commands here.
ULX
ULX is an admin tool that will make dealing with players and changing maps much easier.
WUMA
WUMA allows server administrators to restrict entities and loadouts to particular usergroups or players.
Garry's Mod Wiki
Check out the "Server Owners" section on the Garry's Mod Wiki. It has some helpful tutorials on setting a loading screen and other more advanced topics not covered here.
Turbostroi
You can download the Windows "Turbostroi" binary from here. Without it your server will perform quite poorly. Unzip the downloaded file and then place the ".dll" into your "garrysmod\lua\bin" directory as the README directs. Additionally you should make sure turbostroi is installed on your client.