# Counter-Strike: Source — Complete Dedicated Server Guide

## Startup Parameters
**Default command line**
```bash
srcds_run -game cstrike -console -usercon +hostport 27015 +map de_dust2 +maxplayers 16 +exec server.cfg
```

**Parameters (exhaustive, server-relevant only)**
- `-game <dir>` — Game directory. Required.
- `-console` — Enable server console output.
- `-usercon` — Enable user console commands.
- `+hostport <port>` — Server port (UDP). Default: 27015.
- `+ip <address>` — Bind to specific IP address.
- `+map <mapname>` — Starting map. Required.
- `+maxplayers <num>` — Maximum players (1-64).
- `+exec <file>` — Execute config file on startup.
- `+sv_setsteamaccount <token>` — Game Server Login Token for public servers.
- `+rcon_password <pass>` — RCON password for remote administration.
- `+sv_password <pass>` — Server password for private games.
- `+hostname <name>` — Server name in browser.
- `+sv_lan <0|1>` — LAN mode (0=Internet, 1=LAN only).
- `-tickrate <rate>` — Server tickrate (default: 66, competitive: 128).
- `-port <port>` — Alternative syntax for hostport.
- `-nohltv` — Disable SourceTV.
- `+tv_enable <0|1>` — Enable/disable SourceTV.
- `+tv_port <port>` — SourceTV port (default: hostport + 5).
- `-secure` — Enable VAC (Valve Anti-Cheat).
- `-insecure` — Disable VAC (for testing only).
- `+sv_region <num>` — Server region (255=world, 0-7=specific regions).
- `+fps_max <fps>` — Server FPS limit.
- `-threads <num>` — Number of worker threads.
- `-norestart` — Don't restart server on crash.
- `+log <on|off>` — Enable/disable logging.
- `-condebug` — Log console output to file.
- `+sv_logfile <0|1>` — Enable server logging.
- `+sv_logflush <0|1>` — Flush logs immediately.

**Ports**
- Game: UDP **27015** (primary)
- RCON: TCP **27015** (same as game port)
- SourceTV: UDP **27020** (game port + 5)
- Steam Query: UDP **27016** (game port + 1)

## Config Files & Locations
**Windows:**
- `steamapps/common/Counter-Strike: Source/cfg/server.cfg` — Main server configuration
- `steamapps/common/Counter-Strike: Source/cfg/autoexec.cfg` — Auto-executed commands
- `steamapps/common/Counter-Strike: Source/mapcycle.txt` — Map rotation list
- `steamapps/common/Counter-Strike: Source/motd.txt` — Message of the day
- `steamapps/common/Counter-Strike: Source/banned_user.cfg` — Banned users
- `steamapps/common/Counter-Strike: Source/banned_ip.cfg` — Banned IP addresses
- `steamapps/common/Counter-Strike: Source/logs/` — Server logs directory

**Linux:**
- `~/.steam/steamapps/common/Counter-Strike: Source/cfg/server.cfg` — Main server configuration
- `~/.steam/steamapps/common/Counter-Strike: Source/cfg/autoexec.cfg` — Auto-executed commands
- `~/.steam/steamapps/common/Counter-Strike: Source/mapcycle.txt` — Map rotation list
- `~/.steam/steamapps/common/Counter-Strike: Source/motd.txt` — Message of the day
- `~/.steam/steamapps/common/Counter-Strike: Source/banned_user.cfg` — Banned users
- `~/.steam/steamapps/common/Counter-Strike: Source/banned_ip.cfg` — Banned IP addresses
- `~/.steam/steamapps/common/Counter-Strike: Source/logs/` — Server logs directory

**Key Configuration Files:**
- **server.cfg**: Core server settings (rates, game rules, admin settings)
- **autoexec.cfg**: Commands executed on server start
- **mapcycle.txt**: Map rotation configuration
- **motd.txt**: Welcome message displayed to connecting players

## Steam Workshop
Not supported by this game.

## Common Mods (curated)
- **SourceMod**
  - **Purpose**: Admin and scripting framework for Source engine games.
  - **Install**: Download from sourcemod.net, extract to game directory, requires MetaMod:Source.
  - **Configure**: Edit `addons/sourcemod/configs/admins_simple.ini` for admin users.

- **MetaMod:Source**
  - **Purpose**: Plugin loading framework for Source engine.
  - **Install**: Extract to game directory, add to gameinfo.txt.
  - **Configure**: Plugin loading handled automatically.

- **Mani Admin Plugin**
  - **Purpose**: Alternative admin framework with extensive features.
  - **Install**: Extract to game directory, configure via mani_server.cfg.
  - **Configure**: Admin settings in `cfg/mani_server.cfg`.

## Database
Not applicable - this game does not use a database for core functionality.

## Administration & Scripting
**Remote Administration:**
- RCON (Remote Console) access for server management
- Web-based admin panels (game-specific or third-party)
- In-game admin commands and permissions

**Backup Strategy:**
- Automated daily backups of save files and configuration
- Rotate backups (keep 7 daily, 4 weekly, 12 monthly)
- Test backup restoration procedures regularly
- Store backups in separate location/drive

**Auto-Update:**
- Use SteamCMD for automatic server updates (Steam games)
- Schedule updates during low-traffic periods
- Backup before applying updates
- Monitor for update announcements and patch notes

**Monitoring:**
- Server performance monitoring (CPU, memory, network)
- Player connection logs and statistics
- Error log monitoring and alerting
- Uptime tracking and availability reporting

## Troubleshooting (game-specific)
**"Server not appearing in browser"**
- **Cause**: Missing Game Server Login Token or firewall blocking ports
- **Fix**: Add `+sv_setsteamaccount <token>` to startup, verify ports 27015 UDP/TCP are open

**"VAC Unable to verify"**
- **Cause**: Modified game files or outdated server binaries
- **Fix**: Verify server files integrity via SteamCMD, remove custom plugins temporarily

**"Map change crashes server"**
- **Cause**: Invalid map file or insufficient memory
- **Fix**: Verify map file integrity, increase server memory allocation, check map compatibility

**"High CPU usage/lag"**
- **Cause**: Incorrect tickrate settings or too many plugins
- **Fix**: Adjust `-tickrate` parameter, disable unnecessary plugins, optimize server.cfg rates

**"RCON not working"**
- **Cause**: Incorrect password or blocked TCP port
- **Fix**: Verify `rcon_password` setting, ensure TCP port (same as game port) is accessible

**"Players getting kicked for 'Authentication timeout'"**
- **Cause**: Steam authentication issues or network problems
- **Fix**: Check internet connectivity, verify Steam services status, adjust timeout settings
