Promotiraj s'rv'r
72 lines 7.4 KiB Markdown Source Rendered Raw Permalink History
---
title: "HLDS Command Line Parameters Explained (+maxplayers, -game, +ip)"
excerpt: "What every HLDS launch flag actually does: the difference between dash parameters and plus cvars, and the ones that matter for port binding, master-list visibility, and performance."
category: "installation"
tags: "hlds, parameters"
image: ""
read_time: "8 min read"
---
<p>The HLDS command line looks like line noise the first time you see it, but there is a clean rule underneath: flags that start with a dash (<code>-game</code>, <code>-port</code>) are <strong>engine parameters</strong> read once at startup, and flags that start with a plus (<code>+map</code>, <code>+maxplayers</code>) are <strong>console commands and cvars</strong> executed after the engine boots. Get that distinction and the whole line stops being mysterious.</p>

<h2>The two kinds of argument</h2>
<p>A typical launch:</p>
<pre>./hlds_run -game cstrike -strictportbind -ip 0.0.0.0 -port 27015 \
  +map de_dust2 +maxplayers 20 +sv_lan 0</pre>
<p>Everything before is engine setup; everything with a <code>+</code> is exactly what you could type in the server console. That is why <code>+maxplayers</code> has a plus (it is a command) but <code>-port</code> has a dash (the engine needs it before the console exists).</p>

<h2>Engine parameters (dash)</h2>
<table>
<thead><tr><th>Parameter</th><th>What it does</th></tr></thead>
<tbody>
<tr><td><code>-game cstrike</code></td><td>Loads the Counter-Strike mod. Without it you get vanilla Half-Life. Mandatory.</td></tr>
<tr><td><code>-port 27015</code></td><td>UDP port the server binds. Default 27015. Use this to run several servers on one box.</td></tr>
<tr><td><code>-ip 0.0.0.0</code></td><td>Which local IP to bind. <code>0.0.0.0</code> = all interfaces. Set a specific IP when the box has several and you want one server per IP.</td></tr>
<tr><td><code>-strictportbind</code></td><td>Fail loudly if the port is taken instead of silently grabbing the next free one. Use it always.</td></tr>
<tr><td><code>-console</code></td><td>Plain-text console (Windows). On Linux the console is already text.</td></tr>
<tr><td><code>-insecure</code></td><td>Disable VAC. VAC does almost nothing for CS 1.6 today; this removes the "not secured" line.</td></tr>
<tr><td><code>-nomaster</code></td><td>Do not heartbeat the master list. For a private/LAN server you deliberately want hidden.</td></tr>
<tr><td><code>-pingboost 1|2|3</code></td><td>Alternative timing/sleep strategy for higher server FPS. 3 is the most aggressive; test, do not cargo-cult.</td></tr>
<tr><td><code>-sys_ticrate 1000</code></td><td>Caps the server's FPS (frame loop rate). Higher can smooth movement at a CPU cost.</td></tr>
<tr><td><code>-num_edicts 2048</code></td><td>Raise the entity limit for plugin-heavy servers that hit <code>ED_Alloc: no free edicts</code>.</td></tr>
<tr><td><code>-pidfile hlds.pid</code></td><td>Write the process id to a file — handy for scripts and supervisors.</td></tr>
<tr><td><code>-norestart</code></td><td>Tell <code>hlds_run</code> not to auto-restart the engine after a crash. Use it when systemd is doing the restarting.</td></tr>
</tbody>
</table>

<h2>Console commands and cvars (plus)</h2>
<table>
<thead><tr><th>Command</th><th>What it does</th></tr></thead>
<tbody>
<tr><td><code>+map de_dust2</code></td><td>The map to start on. Required — without a start map the server has nothing to load.</td></tr>
<tr><td><code>+maxplayers 20</code></td><td>Slot count. This is the real player cap; set it here, not only in cfg.</td></tr>
<tr><td><code>+sv_lan 0</code></td><td><strong>0 to appear on the internet master list.</strong> With 1 the server never heartbeats and Steam clients are refused.</td></tr>
<tr><td><code>+exec server.cfg</code></td><td>Execute a config after boot. <code>server.cfg</code> is auto-executed anyway; use this for extra files.</td></tr>
<tr><td><code>+servercfgfile game.cfg</code></td><td>Change which cfg the engine auto-execs as the server config.</td></tr>
<tr><td><code>+ip 1.2.3.4</code></td><td>Cvar form of the bind IP; the dash <code>-ip</code> is preferred and set earlier.</td></tr>
<tr><td><code>+rcon_password ...</code></td><td>Set RCON here to keep it out of a world-readable cfg if you like. It still ends up in memory.</td></tr>
</tbody>
</table>

<h2>hlds_run vs hlds_linux</h2>
<p>On Linux you almost always launch <code>hlds_run</code>, a shell wrapper that starts <code>hlds_linux</code>, captures its output to <code>debug.log</code>, and restarts it after a crash. Under a <a href="/tutorials/hlds-systemd-service">systemd service</a> you generally want one restarter, not two — either let systemd restart and pass <code>-norestart</code> to <code>hlds_run</code>, or run <code>hlds_linux</code> directly.</p>

<h2>Quoting and ordering</h2>
<p>Two practical rules save a lot of debugging. First, keep all dash parameters before all plus commands on the line — some shells and the engine's own parser get confused when they are interleaved, and a misparsed <code>+sv_lan 0</code> can leave you on the LAN list wondering why. Second, quote any value with a space, especially through a shell: a hostname belongs in <code>server.cfg</code> rather than on the command line for exactly this reason. When you need several config files, chain them with repeated <code>+exec</code> — they run in order after the map loads:</p>
<pre>+exec server.cfg +exec bans.cfg +exec plugins.cfg</pre>

<h2>Windows differences</h2>
<p>On Windows you launch <code>hlds.exe</code> rather than <code>hlds_run</code>, and <code>-console</code> is worth adding to get the readable text console instead of the old dialog window. There is no <code>hlds_run</code> wrapper, so crash-restart is your batch file's or supervisor's job, and <code>-norestart</code> is meaningless there. Otherwise the parameter set — <code>-game</code>, <code>-port</code>, <code>+map</code>, <code>+maxplayers</code>, <code>+sv_lan</code> — is identical across platforms.</p>

<h2>Common mistakes</h2>
<ul>
<li><strong>Server takes the wrong port</strong> — you launched two instances without <code>-strictportbind</code>; the second silently used 27016. Always pass it.</li>
<li><strong>Server invisible in the internet list</strong> — <code>+sv_lan 1</code> (or a leftover <code>sv_lan 1</code> in cfg), or you passed <code>-nomaster</code>. Set <code>+sv_lan 0</code> and drop <code>-nomaster</code>.</li>
<li><strong><code>+maxplayers</code> ignored</strong> — you put <code>maxplayers</code> in <code>server.cfg</code>; it is a launch-time value, so pass <code>+maxplayers</code> on the command line.</li>
<li><strong><code>ED_Alloc: no free edicts</code></strong> — plugin-heavy server hitting the entity ceiling. Add <code>-num_edicts 2048</code>.</li>
<li><strong>Config seems half-applied</strong> — engine parameters after a <code>+command</code> can be misparsed by shells; keep all <code>-</code> flags first, then all <code>+</code> commands.</li>
</ul>

<h2>Verification</h2>
<p>After launch, check the bind and the runtime values agree with your flags:</p>
<pre>ss -lunp | grep 27015</pre>
<p>confirms the port. In the console, <code>status</code> shows the map and slot count you asked for, and <code>sv_lan</code> echoes <code>0</code>. If all three match your command line, the parameters took. From here, fold the working command line into a <a href="/tutorials/hlds-systemd-service">systemd unit</a> and move gameplay settings into an <a href="/tutorials/setup-server-cfg-cs16">annotated server.cfg</a>.</p>