How to configure SA-MP server.cfg line by line
Understand every server.cfg directive in SA-MP, recommended values, and how to safely tune slots, RCON, plugins, gamemodes and ports for production.
server.cfg is the main configuration file for an SA-MP server. It sits at the root of the server folder, next to the samp03svr executable (Linux) or samp-server.exe (Windows), and is only read at boot. Any change requires restarting the server to take effect.
Most new owners copy a ready-made server.cfg from the internet without understanding what each line does — and then run into a server that never shows up on the masterlist, exposed RCON, broken plugins or wrong slot counts. This guide explains every relevant directive, shows recommended values, and points out the most common pitfalls. Estimated reading and tuning time: 15 to 20 minutes.
The persona here is someone who has just downloaded the SA-MP server package, is setting up their first server (RP, freeroam, deathmatch or stunt), and wants to understand what they are editing before going to production.
Prerequisites
You need the SA-MP server 0.3.7-R3 (or R4) package already extracted, shell access to the server (SSH on Linux or Remote Desktop on Windows) and a plain-text editor — nano, vim, VS Code or Notepad++. Editors like Word or WordPad corrupt the encoding and break boot.
server.cfg SA-MP server root ANSI / Windows-1252 7777 Encoding matters: SA-MP 0.3.7 reads the file as ANSI/Windows-1252. If you save it as UTF-8 with BOM, the server may fail on the first line (echo) or render accented characters incorrectly in the hostname.
Basic server.cfg structure
The file is a flat list of directive value pairs, one per line, separated by spaces (not =). Comments start with // or # on some builds, but the safest approach is to simply remove lines you do not use. Directive order does not matter to the parser, but it helps to group by context: identification, networking, security, content, plugins.
A minimal working server.cfg is about 12 lines. The examples shipped with the official package include 20+ directives — many of them optional. We will cover the essentials.
Identification and network directives
These lines control how the server presents itself in the public list and which UDP port it listens on.
Set the public server name with hostname:
hostname My RP Server [EN]hostname is what appears in the SA-MP server browser. Practical limit: 50 visible characters. Stick to plain ASCII whenever possible — accented characters may render as ? on the client depending on the player’s locale.
Configure the UDP port:
port 7777The default port is 7777. If you run multiple servers on the same IP, increment: 7778, 7779. Confirm the port is open in the firewall for UDP (not TCP — SA-MP is strictly UDP).
Define the available slots:
maxplayers 100maxplayers accepts up to 1000 in SA-MP 0.3.7, but the real number depends on the gamemode and CPU. Typical values: 50 for high-quality RP, 100-200 for freeroam, 500+ requires careful tuning of timers and streamers.
Register the server in the public masterlist:
announce 1With announce 1, the server reports status to the SA-MP masterlist every 2 minutes. Use 0 for a private or test server — it remains reachable by direct IP but does not show up in the public list.
If the server is behind NAT (home, office), you need UDP port forwarding from port 7777 on the router to the internal IP of the machine. Without it, external players cannot connect and the masterlist cannot validate the server.
Security and administration directives
These control administrative access and protection against abuse.
Set the RCON password:
rcon_password J8kQ3pX9Lm2nR7vFRCON (Remote Console) lets you run administrative commands at runtime: kick, ban, gamemode reload. A weak password is equivalent to leaving the server wide open. Generate 16+ random characters. Never commit server.cfg to a public repository with the real password.
Decide whether remote RCON stays enabled:
rcon 1rcon 1 allows login through /rcon login <password> from any connected client. rcon 0 disables it — you can still use RCON from the server console. For production, disabling is safer.
Configure optional protection against query spam:
query 1query 1 (default) responds to pings from the server browser. query 0 hides the server from the browser but keeps it playable by IP. Useful for development servers or private events.
There are documented cases of SA-MP servers taken over by RCON brute-force. If you use changeme, admin, 123456 or similar, the server can be hijacked in minutes. Treat rcon_password the same way you would treat an SSH root password.
Content directives: gamemode, filterscripts and plugins
This is where the server decides what to actually run.
Set the primary gamemode:
gamemode0 grandlarc 1The syntax is gamemodeN <name-without-extension> <repetitions>. The name refers to a .amx file in gamemodes/. The second number is how many times that mode runs before advancing to the next one. Use 1 if you only have one gamemode.
For mode rotation:
gamemode0 dm 2
gamemode1 race 1
gamemode2 derby 1Here the server runs dm twice, then race once, then derby once, and loops back to dm.
List filterscripts (auxiliary scripts):
filterscripts gl_actions gl_property gl_mapiconFilterscripts live in filterscripts/ as .amx. They are optional modules loaded in parallel to the gamemode. Separated by spaces. Use them for isolated features: admin commands, property systems, basic anti-cheat.
Load native plugins:
plugins streamer mysql sscanfOn Linux, plugins are .so files in plugins/. On Windows, .dll. Do not include the extension in the line. Typical plugins: streamer (dynamic objects/pickups), mysql (database), sscanf (parameter parsing), crashdetect (runtime error debugging).
Plugins are loaded in the listed order. Some depend on others (for example, crashdetect needs to load before streamer in some versions). If the server crashes at boot with failed to load plugin, try reordering before assuming the plugin is corrupted.
Common optional directives
Lines that show up in many server.cfg files but not every server uses.
| Directive | Purpose | Default | When to adjust |
|---|---|---|---|
maxnpc | Slots for server-controlled bots | 0 | Raise only if gamemode uses NPCs |
lanmode | Run in LAN mode (no masterlist) | 0 | 1 only for internal local network |
password | Password required to join the server | empty | Private/whitelist server |
weburl | URL shown in server info | empty | Community site/discord |
mapname | Map name displayed | ”San Andreas” | Customize for themed freeroam |
language | Language shown in browser | ”English" | "Portuguese”, “Spanish”, etc |
chatlogging | Save chat log to file | 1 | 0 to reduce I/O on large servers |
timestamp | Timestamp in log entries | 1 | Keep at 1 always |
logqueries | Log browser queries | 0 | 1 only for debugging |
Verification after editing
After saving server.cfg, restart the server and read the boot log.
Start the server and watch the output:
./samp03svrOn Windows:
samp-server.exeCheck the log for these lines:
SA-MP Dedicated Server
----------------------
v0.3.7-R3, (C)2005-2015 SA-MP Team
[XX:XX:XX] Server Plugins
[XX:XX:XX] Loaded 3 plugins.
[XX:XX:XX] Filterscripts
[XX:XX:XX] Loaded 3 filterscripts.
[XX:XX:XX] Number of vehicle models: XXIf you see Failed (plugins/X.so) or Failed.amx on a gamemode/filterscript, the configuration references a file that does not exist — check names and paths.
Use samp-monitor.com or a similar site to confirm the server is visible from the outside. If the monitor cannot reach it, the problem is firewall or NAT, not server.cfg.
Common troubleshooting
Server starts but does not appear on the masterlist
Check announce 1, confirm UDP port 7777 is open in the firewall, and that the server is not behind NAT without port forwarding. The masterlist runs an external validation query — if it fails, the server is dropped from the list within ~10 minutes.
”Server failed to initialize” at boot
Almost always an encoding issue (server.cfg saved as UTF-8 with BOM) or an invalid character in hostname. Resave as ANSI and stick to ASCII in the name.
Plugins load but native functions return “undefined symbol”
Plugin version is incompatible with the gamemode. Plugins compiled for 0.3.7 do not work on 0.3.DL and vice versa. Check the samp03svr version (./samp03svr --version) and download the matching plugin build.
RCON accepts commands but they do nothing
The user ran /rcon login but is not running commands with the /rcon prefix. RCON commands always require the prefix: /rcon kick 5, not just kick 5.
Next steps
With server.cfg properly tuned, a few directions are worth exploring:
- Versioning: keep
server.cfg(withoutrcon_password) in git, with the password in a separate file read by a wrapper script. This lets you track changes and roll back. - Uptime monitoring: configure an external monitor (UptimeRobot or similar) with a UDP check on port 7777 — alerts when the server goes down.
- Automatic backups of gamemode and scriptfiles: SA-MP stores player progress in
scriptfiles/. A daily cron withtaris enough. - Streamer tuning: the biggest source of lag in SA-MP is poorly tuned objects/pickups. Adjust
Streamer_TickRateand tile size based on the real player count.
If you are moving the server into production with real players, dedicated SA-MP hosting from Hostini ships with UDP port 7777 open by default, DDoS protection tailored for game protocols and low latency to Brazil — which helps players stay online during the UDP attack waves that are common in this community.
Frequently asked questions
What is the difference between gamemode0, gamemode1 and gamemode15?
They are rotation slots for gamemodes. server.cfg accepts up to 15 entries (gamemode0 through gamemode14). When the current gamemode ends or calls GameModeExit(), the server loads the next one in circular order. If you run a single mode, keep only the gamemode0 line.
Why does my server not appear on the public list even with announce 1?
The announce 1 directive only registers the server with the SA-MP masterlist. If the server is behind NAT without UDP port forwarding on 7777, or the port is firewalled, the masterlist cannot validate it and the server is dropped. Also confirm the server is not behind Cloudflare or a TCP proxy — SA-MP requires direct UDP.
Can I run two SA-MP servers on the same IP?
Yes, as long as each one uses a different UDP port. Change the port directive in the second server.cfg to 7778, 7779 or another free port, and open it in the firewall. Remember the port must be open for inbound UDP, not just outbound.
Is it safe to keep the default rcon_password 'changeme'?
No. Leaving 'changeme' or any weak password exposes the server to remote takeover — anyone can run administrative commands through RCON. Use at least 16 random characters and consider disabling remote RCON (rcon 0) if you only manage the server through the local console.
What does maxnpc actually do and when should I raise it?
maxnpc defines how many server-controlled bots (NPCs) can exist at the same time. Each NPC uses a slot and a bit of CPU. Raise it only if the gamemode actively uses NPCs (racing, automated missions). For standard RP servers, leaving it at 0 saves resources.
What happens if I list a .so/.dll plugin but the file is missing?
The server prints 'Failed (plugins/X.so): ...' in the console and continues to boot without that plugin. The plugin's native functions become unknown, causing 'undefined symbol' errors in any gamemode that depends on them. Always read the boot log to confirm every listed plugin loaded successfully.