From GMod Wiki
This article is about creating and administrating a server. If you are looking for the wiki administrators, go to GMod Wiki:Administrators.
| Go to:|
Installing SCRDS, Garry's Mod, and default server configuration settings:
- For Windows, see: Windows Dedicated Server Setup
- For Linux, see: Linux Dedicated Server Setup
- For additional help, see: General Server Setup Information
- See: Server Settings- includes an example server.cfg at the bottom of the page.
Server.cfg is the name of the configuration (.cfg) file that runs every time your server is started and every time you change maps. This file is used for storing you server's identity, default settings, and information for user management and logging purposes. Most server.cfg files are set up to handle Sandbox gamemode and its derivatives. If you plan to primarily host a custom gamemode, you should check the gamemode's website or readme about specific settings to place in your server.cfg.
You can "force" players download non standard files from your server (usually assets from addons on your server) by using the commands resource.AddFile() and resource.AddSingleFile(). This is useful for server owners that allow custom content for subscribers and admins. You can find example usages in the above linked page- note that resource.AddSingleFile() and adding each necessary file manually is generally accepted as the best practice to force downloads to clients, for resource.AddFile() may attempt to force downloading of companion files (like phys for models) that may not be present in all files by default- causing the client to become spammed with lua console errors. Usage:
- For each non- .lua file you want clients to download, add a resource.AddSingleFile( "..folder/file.type" )(Note: you must use quotes around the filepath.) to your game server's "garrysmod/lua/autorun/server/forceddownloads.lua" (you may have to create "forceddownloads.lua if it does not exist: You can simply create a "forceddownloads.txt" in a plain text editor like NotePad and save the file as "forceddownloads.lua" in "garrysmod/lua/autorun/server/"
- For each .lua (script) file, add a "AddCSLuaFile( "..folder/file.lua" )" line to "forceddownloads.lua"
Remote file downloads:sv_downloadurl
- Full article: The Gmod Wiki guide to setting up sv_downloadurl
sv_downloadurl specifies a URL that leads to your game server's content files on an HTTP web space, allowing for faster download speeds than Garry's Mod's default of 20Kb/s. Server operators place an "sv_downloadurl" in their server's "server.cfg" to point to copies of their server's content online.
Setting Administrator Rights
Garry's Mod handles administrator access differently, depending on the server type.
In Listen Servers
- Full Article: Listen Server
If you are running a listen (client) server, you automatically become the server's "admin". You will be able to use admin-only scripted items, the admin portion of the in-game "options" menu, etc.
In Dedicated Servers
- See: Groups and Users.txt
In order to administrate a default dedicated server, your Steam ID must be in the "users.txt" file found in the game server's "garrysmod\settings\" directory.
- Note: Your Steam ID will display upon typing "status" during any multi-player game in the developer console and finding the line with your name. The format of a Steam ID is "STEAM_X:X:XXXXXXX".
In Game Administration
- The following section assumes you have no administration addons installed. For a list of administration addons, see Section: Administration Addons
- For administering the server without being connected, see RCON- Remote Console
The Console-Cvars and Configuration files
- See: Console
Console variables (cvars) are settings that you can change from the game's console. These variables can be used to change anything from the server's name (hostname), to the amount of gravity simulated on the server (sv_gravity). To search for a specific variable, use the
command in the console, followed by the first few letters of a command. For example, typing
will list every cvar that begins with "sv_". For hints on what a variable controls and how to use it, type
This will list the name of the variable, whether the variable is cheat protected (requires sv_cheats 1), and a small description of what the variable is used for.
You can take groups of variables (cvars) and execute them all at once by placing them in a config (.cfg) file. This can be useful for starting specific modes on your server in which several variables must be changed. To create a config file, just create a blank .txt file in a plain text editor, such as Window's "NotePad" or the open source program "NotePad++", place each cvar you wish to use and its setting on its own line with the format:
- Note that quotation marks (") are placed around the value.
For examples on how configs are used, open your game server's "server.cfg", located at "garrysmod/cfg/server.cfg". This file should list settings that are global to your server, just as the "hostname", "sv_region", and "sv_defaultgamemode". Server.cfg is run every time the server is started, and every time the map is changed.
|Note: Some Game Server Providers use a server_config.txt instead of a server.cfg. If you have trouble finding your server.cfg or server_config.txt, seek support from your GSP.|
To run a config file from in-game, use the command
This will evaluate the cvars inside the exec. For other common cvars and .cfg files, see Server Settings.
The scoreboard (default key:Tab) is a good way, in most gamemodes, to get a general sense of your players' activities. In Sandbox, the scoreboard can display how many props, vehicles, NPCs, etc. that each player has spawned at a time. In custom gamemodes, the scoreboard wll often show the players kills, deaths, kill/death ratio, etc.
The console command "status" is usually used as a user information and management tool- typing "status" in console provides this output:
For each user connected to the server, "status" provides (in order, from left to right:)Note the column "User ID"- This number is an identifier given by the server to the client for the duration of his server session.
- User ID (explained below)
- Unique ID (Steam ID)
- Connected (total connection time for the current session) (Format: Days:Hours:Minutes:Seconds)
- Ping (in miliseconds)
- Loss ("0" indicates the user is experiencing no packet loss. Any other number indicates the user is experiencing loss)
User Management Commands
- kickid- Used to kick a player by his User ID
- kick- Used to kick a player by his name or Unique ID (Steam ID).
- banid- Used to ban a player by his User ID
- ban- Used to ban a player by his name of Unique ID (Steam ID).
For kick and ban, type the following into your console:
<command> <Name or Unique ID> (for bans, add <ban length> here) <reason>
The reason will be displayed to the user in a message after they have been kicked or banned.
For kickid and banid, type:
<command> <User ID> (for bans, add <ban length> here) <reason>
kickid and banid are useful for quickly booting players in smaller servers who are causing disruptions, since most User IDs will be much shorter than the user's name or Steam ID.
- To ban users permanently, use a <ban length> of zero (0) minutes.
RCON- Remote Administration
The explanations above have so far been tailored towards administrators that are connected to the server they wish to administrate. But it is possible to adminisrate a server without actually connecting to the game in progress. This is called "Remote Console" (rcon). The most popular rcons are:
- The Server Console- The console window on the game server when "srcds.exe" is run. This will not be available to most GSP customers.
- Game Server Administration Tool- These third-party programs are designed to allow server operators to administrate game servers without being connected to to the game in progress. One popular example of this type of program is [www.hlsw.org Half Life Server Watcher]
These programs function much like your in-game console- you can type commands (like cvars) into them to change settings and manage users. To enable this functionality, you'll have to input the server IP (if using a tool like HLSW) and the command
inputting the password set for you server (usually, rcon passwords are set in your game server's "server.cfg").
Many Dedicated servers (including those provided by GSPs) come with several options for Admin addons to allow for a more functionally complete and graphical user interface based admin mod. Some examples of these administration mods:
- Evolve - Last release: Jan 18, 2011
- An admin mod with a nice GUI and a lot of features. It's still in the beta phase, but it's fairly stable, so certainly worth it to try it out. (http://evolvemod.googlecode.com/svn/trunk/beta)
- Exsto - Last release: Sept 8, 2010
- An advanced modular administration system. A simple way to state that is that Exsto emphisizes modularity in plugins, GUI, and everything else. It allows for complete custom ranks with different immunities, with import support from ULX. It also is data efficient, using SQL databases for its storage. (http://www.facepunch.com/showthread.php?t=937056)
- ULX - Last release: Apr 24, 2011
- A well known and trusted administration control set, it was the first admin mod, and is still being updated today. It allows multiple admins with different access levels on the same server. It contains features from basic kick, ban, and slay to fancier commands such as blind, freeze, voting, and more. ULX is available for download at http://www.ulyssesmod.net.
- FAdmin mod - A simple Admin mod. Integrated into the DarkRP gamemode to allow easier administration and control over the server.