Fix: server.cfg Settings Not Applying

May 20, 2025 Daemon666 7 min read 13 wyświetleń

You edit server.cfg, restart, and half your settings are ignored. This is almost never a "config is broken" problem and almost always an ordering or naming problem: the engine reads several config files in a fixed sequence, a later one overrides an earlier one, and a handful of cvars cannot be set from server.cfg at all. This guide walks the real execution order and the traps that silently discard your settings.

1. Confirm the file is where the engine actually looks

server.cfg must live in the mod folder, next to maps/ and addons/:

/home/steam/hlds/cstrike/server.cfg

Not in the server root, not in a config/ subfolder. HLDS execs cstrike/server.cfg and nothing else by that name.

2. Rule out the hidden .txt extension

On Windows, Explorer hides known extensions, so a file you "named" server.cfg is really server.cfg.txt. The engine never execs it and never warns you.

dir C:\hlds\cstrike\server.cfg*

If that lists server.cfg.txt, rename it, and turn on File name extensions in the Explorer View ribbon first. On Linux, run ls -la and check for a trailing space or a stray capital letter in the name.

3. Understand when server.cfg runs

server.cfg is executed once per map load, after the map has started — not the instant the process boots. Any cvar you change live in the console is overwritten on the next map by whatever server.cfg contains. Conversely, a value you set in server.cfg is overridden if something later in the chain sets it again. The order that matters:

  1. Command-line +cvar arguments
  2. cstrike/server.cfg (on map start)
  3. A per-map file such as cstrike/de_dust2.cfg, if one exists
  4. AMX Mod X configs (addons/amxmodx/configs/amxx.cfg and per-plugin configs), which are exec'd a moment later during plugin_cfg

The last writer wins. If amxx.cfg or a plugin sets mp_freezetime, it beats your server.cfg because it runs afterward.

4. Watch it execute

Set a marker at the very top of server.cfg:

echo "===== server.cfg START ====="
hostname "My Server"

Restart and watch the console. If the banner never prints, the file is not being read (wrong path or wrong name — go back to steps 1–2). You can also force it in the live console:

exec server.cfg

If a manual exec applies the values but a restart does not, something later in the sequence is overriding them.

5. Cvars server.cfg cannot set

  • maxplayers — set with +maxplayers 20 on the command line. maxplayers 20 in server.cfg does nothing.
  • port / ip — command line only (-port 27015 -ip 0.0.0.0).
  • sv_lan — works in server.cfg, but if you also pass +sv_lan 1 on the command line the two can fight; keep it in exactly one place. See server only visible on LAN.

6. Syntax traps

  • Comments are //, not #. A # line is parsed as a broken command and spams Unknown command.
  • Values with spaces need quotes: hostname "My Cool Server". Without quotes only the first word is taken.
  • Save as plain UTF-8 without a BOM. A byte-order mark makes the engine choke on the first line only.
  • One command per line; no trailing semicolons.

7. Nested execs and read-only cvars

A single server.cfg can chain into others with exec. If yours does exec rates.cfg and that file is missing, the engine prints Couldn't exec rates.cfg and silently skips whatever you expected it to set — so scan the boot log for any Couldn't exec line. Separately, a few cvars are read-only or latched: they only take a new value on the next map, not immediately. If a value refuses to change even after a manual exec, it is latched — change the map and re-check. And never rely on setting a cvar that belongs to a plugin (an amx_ or a ReGameDLL mp_ cvar) before that plugin has loaded; put those in a config the plugin execs, or in amxx.cfg, which runs after the plugin is ready.

Common errors

  • Setting applies, then reverts on map change — an AMXX plugin or a per-map .cfg resets it. Grep your configs: grep -rn mp_freezetime cstrike/.
  • Nothing in server.cfg applies — the file is server.cfg.txt, or it is in the wrong directory.
  • Only the first line applies — a BOM or a bad character on line 2; re-save as plain UTF-8.
  • Unknown command spam at boot — you used # comments, or referenced a cvar from a plugin that is not loaded yet.

Verification

After a restart, read the value back by typing the cvar name with no argument:

mp_freezetime

The console prints "mp_freezetime" is "3". If that matches server.cfg, the setting stuck. Repeat for every cvar you care about — that read-back is the only proof that survives the full exec chain. For a clean annotated file to start from, see the Linux install guide.

Współtwórcy: Daemon666 ✦
Udostępnij: