EN · $ USD
FiveM and Roleplay Servers

FiveM server.cfg Explained Line by Line

7 min read Updated: OyunBulut technical team

In short

FiveM server.cfg is the main config file FXServer reads at startup. It sets the connection port (endpoint_add_tcp/udp, default 30120), the server name (sv_hostname), slot count (sv_maxclients), public listing info (sets), OneSync, the license key (sv_licenseKey) and which scripts start in what order (ensure). Dependencies must always be listed before the scripts that use them.

In this guide
  1. Example server.cfg (Turkish roleplay server)
  2. set vs setr vs sets
  3. Network lines: endpoint_add_tcp and endpoint_add_udp
  4. Server identity: sv_hostname and sets lines
  5. Capacity: sv_maxclients and OneSync
  6. ensure order: the most critical part
  7. Security lines
  8. License key: sv_licenseKey
  9. 7 common server.cfg mistakes
  10. Other useful lines
  11. File layout for large servers
  12. Pre-edit checklist
  13. Applying changes
  14. Next step: a server where you can edit the file

FiveM server.cfg is the main config file FXServer reads from top to bottom at startup. It decides which port the server listens on, what name it shows in the server list, how many players it accepts, the license key and the order scripts start in. Below you'll find a complete example file with an explanation of every line, and at the end, the most common mistakes.

Example server.cfg (Turkish roleplay server)

# --- Network ---
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

# --- Database ---
set mysql_connection_string "mysql://kullanici:sifre@127.0.0.1/fivem?charset=utf8mb4"

# --- Core resources ---
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure hardcap

# --- Dependencies (BEFORE the framework) ---
ensure oxmysql
ensure ox_lib

# --- Framework and scripts ---
ensure es_extended
ensure [esx_eklentiler]
ensure [scriptler]

# --- Server info ---
sv_hostname "^5Sunucu Adınız ^7| Türkçe Roleplay"
sets sv_projectName "Sunucu Adınız"
sets sv_projectDesc "Ciddi roleplay, aktif yetkili ekibi"
sets tags "roleplay, turkish, serious"
sets locale "tr-TR"
load_server_icon logo.png

# --- Gameplay and security ---
sv_maxclients 48
set onesync on
sv_scriptHookAllowed 0
sv_endpointPrivacy true
set steam_webApiKey "none"

# --- Permissions ---
add_ace group.admin command allow
add_ace group.admin command.quit deny
add_principal identifier.fivem:1234567 group.admin

# --- License ---
sv_licenseKey "LISANS_ANAHTARINIZ"

This example is written for an ESX-based server. On QBCore, qb-core replaces es_extended, and on QBox it's qbx_core; the logic is the same.

set vs setr vs sets

There are three ways to assign values to variables (convars) in server.cfg, and mixing them up is a common mistake:

CommandWho can see it?Typical use
setServer onlyDatabase connection, API keys
setrServer and player clientsSettings that client scripts need to read
setsEveryone in the server listDescription, tags, language

The rule is simple: never write a value containing a password or key with setr or sets. Those values are sent to players or to the public list.

Network lines: endpoint_add_tcp and endpoint_add_udp

These two lines tell FXServer which IP and port to listen on. 0.0.0.0 means listening on all network interfaces on the machine and is the right choice in most cases. The default port is 30120; the TCP and UDP lines must point to the same port. On managed game servers, the port is assigned by the provider, so check your service details before changing these lines manually.

Server identity: sv_hostname and sets lines

  • sv_hostname: The name shown in the server list. Codes from ^0 to ^9 set colors; ^7 switches back to white.
  • sets sv_projectName / sv_projectDesc: The project name and short description shown in the list and on the connecting screen.
  • sets tags: Comma-separated tags. Players filter the list with them; a few accurate tags work better than a long list.
  • sets locale: The server's language, for example tr-TR for Turkish servers or en-US for US English.
  • load_server_icon: Sets a 96x96 pixel PNG file in the same folder as server.cfg as the server icon.

For more on choosing a title and tags that stand out in the list, see the FiveM server promotion guide.

Capacity: sv_maxclients and OneSync

sv_maxclients sets how many players can be connected at once. OneSync is the sync infrastructure that manages game state on the server side and is a prerequisite for higher slot counts. It's enabled with set onesync on; most current frameworks assume OneSync is on.

  • With OneSync enabled, you can go up to 48 slots for free.
  • Above 48 requires Cfx.re's paid Element Club subscription; without it, FXServer won't accept the higher value.

Raising the slot count also raises hardware requirements. Every new player means new entities the server has to sync; a full 48-slot roleplay server needs far more CPU and RAM than an empty test server. For details, see the OneSync and slot increase guide.

ensure order: the most critical part

ensure starts a resource, or restarts it if it's already running. The older start command still works, but ensure is preferred. Lines with square brackets (ensure [scriptler]) start every resource in that folder.

FXServer starts resources in the order they appear in server.cfg. If a script needs a dependency that hasn't started yet, it throws an error. The correct order is always:

  1. Core CFX resources (mapmanager, chat, spawnmanager, sessionmanager)
  2. Database driver (oxmysql)
  3. Shared libraries (ox_lib, etc.)
  4. Framework core (es_extended, qb-core or qbx_core)
  5. Framework-dependent systems such as inventory and targeting
  6. Jobs, vehicles, maps and other scripts

Splitting resources into category folders ([framework], [araclar], [haritalar]) makes it easier both to manage the order and to find a problem script.

Security lines

  • sv_scriptHookAllowed 0: Blocks players from connecting with ScriptHook-based single-player mods. Keep it at 0 on roleplay servers.
  • sv_endpointPrivacy true: Hides players' IP addresses from other players.
  • add_ace / add_principal: The ACE permission system. add_principal adds a player identifier to a group, and add_ace allows or denies a permission for that group.
  • set mysql_connection_string: Must always be written with set and never uploaded to a public repository.

License key: sv_licenseKey

The key you got from the Cfx.re portal goes on this line in quotes. If the key is missing or wrong, the server won't start. Leaving the key in a server.cfg uploaded to a public place like GitHub is one of the most common security mistakes; instead, keep it in a separate file and load it with exec:

# server.cfg
exec gizli.cfg

# gizli.cfg (do not commit to the repo)
sv_licenseKey "LISANS_ANAHTARINIZ"
set mysql_connection_string "mysql://kullanici:sifre@127.0.0.1/fivem?charset=utf8mb4"

7 common server.cfg mistakes

  1. Starting a dependency too late: If the es_extended line comes before oxmysql, the framework can't connect to the database.
  2. Ensuring the same resource twice: A script started both individually and as part of a folder loads twice and causes unexpected errors.
  3. Forgetting quotes: Values containing spaces (hostname, description, connection string) must be in quotes.
  4. Setting sv_maxclients above 48: Without an Element Club subscription, the server won't accept this value.
  5. Writing a secret with sets: It becomes visible to everyone in the list.
  6. Wrong endpoint: Entering a specific IP that the server doesn't own means FXServer can't listen.
  7. Folder name and ensure name don't match: The name on the ensure line must exactly match the resource folder name.

Other useful lines

  • sv_enforceGameBuild: Sets which GTA V game build players connect with. New DLC vehicles, clothing and maps are only available once the matching build is enforced. Before raising the value, check that your scripts are compatible with that build; valid build numbers are listed in the official FiveM documentation.
  • sets banner_detail and sets banner_connecting: URLs of the banner images shown on the server detail page and the connecting screen.
  • sv_master1 "": If you add this line, the server won't register with the public list. Handy for private test servers; if you forget it on a live server, players can't find you in the list.
  • exec: Loads another cfg file. Splitting permissions into permissions.cfg and resources into resources.cfg keeps large servers organized.

File layout for large servers

Once you pass a hundred scripts, a single server.cfg becomes hard to read. A common, maintainable layout looks like this:

# server.cfg
exec gizli.cfg
exec permissions.cfg
exec resources.cfg

sv_hostname "^5Sunucu Adınız ^7| Türkçe Roleplay"
sv_maxclients 48
set onesync on

resources.cfg contains only ensure lines, and permissions.cfg contains only ACE lines. When something breaks, you know right away which file to check. The order of exec lines matters too: files are read in the order they're listed.

Pre-edit checklist

  • Before making changes, save a copy of your current server.cfg (for example server.cfg.bak).
  • Save the file with UTF-8 encoding; wrong encoding is the most common cause of garbled server names that use non-English characters such as Turkish letters.
  • Make one change at a time, then restart the server and check the console.
  • Use # for comments; noting why you added something will save you time months later.

Applying changes

server.cfg is only read at startup. Restart the server for convar and slot changes. If you added a new script, you can test it without shutting down the whole server by typing refresh and then ensure kaynak_adi in the console.

Next step: a server where you can edit the file

To experiment freely with server.cfg, you need a server with full file access. OyunBulut FiveM server plans come with automatic setup; the initial server.cfg is created for you and you just add your own settings. For a small roleplay server with a framework, the OB-FIVEM-2 plan with 2 CPUs, 4 GB DDR5 RAM and 50 GB NVMe storage is a good start. As your script count grows, you can move to FiveM plans with more RAM.

Frequently asked questions

Where is the FiveM server.cfg file located?

server.cfg sits in the root of the server data folder, at the same level as the resources folder. If you set up with txAdmin, the txAdmin settings show which cfg file is in use.

What's the difference between ensure and start?

start only starts a resource; ensure starts it if it isn't running and restarts it if it is. Using ensure is recommended for current setups.

How many slots does a FiveM server get for free?

With OneSync enabled, up to 48 slots are free. Higher slot counts require Cfx.re's paid Element Club subscription.

What should I put in the sets tags line?

Add a few comma-separated tags that best describe your server, for example roleplay, turkish. Adding unrelated tags makes you show up in the wrong place in players' filters.

Do I need to restart the server after editing server.cfg?

Yes, server.cfg is only read at startup. To test a new script, though, the refresh and ensure commands in the console are enough.

For this guide

Recommended plans

The OB-FIVEM-2 plan comes with automatic setup and a ready-made server.cfg, and since it gives you full file access, you can apply the settings in this guide directly on your own server.

OB-FIVEM-2

Recommended

4 GB DDR5 RAM

$11.01/mo

+VAT

  • Processor2 CPU
  • Disk50 GB NVMe
  • LocationIstanbul
  • DDoS
  • Automatic Setup

2 GB DDR5 RAM

$7.86/mo

+VAT

  • Processor2 CPU
  • Disk40 GB NVMe
  • LocationIstanbul
  • DDoS
  • Automatic Setup

6 GB DDR5 RAM

$15.73/mo

+VAT

  • Processor4 CPU
  • Disk60 GB NVMe
  • LocationIstanbul
  • DDoS
  • Automatic Setup

FiveM — tüm paketler

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.