Understand and Configure Your server.cfg
in FiveM
The server.cfg
file is the primary configuration file for your FiveM server. This is where you set important options such as license key, resources, database connections, and more. Below, we’ll go through the different sections of the example you provided. Customize the file to suit your server’s needs and setup.
1. Basic Server Settings
sv_master1
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
- sv_master1: Registers your server on the FiveM master list, making it discoverable by other players.
- endpoint_add_tcp / endpoint_add_udp: Shows which IP and port the server binds to. These are usually set automatically when the server starts, so you typically don’t need to change them manually.
2. Tags and Privacy
sets tags "roleplay, dansk, english"
sv_endpointprivacy true
net_maxPackets 50
sv_forceIndirectListing false
sv_connectTimeout 120
sv_maxclients 48
- sets tags: Adds keywords (tags) to your server so players can find it more easily, such as “roleplay,” “dansk,” etc.
- sv_endpointprivacy: When set to
true
, this hides players’ IP addresses in certain logs and scripts. - net_maxPackets: Limits the number of packet transmissions per tick to help manage server load.
- sv_forceIndirectListing: When set to
false
, your server can appear directly in the FiveM server list. - sv_connectTimeout: Specifies how many seconds players have to complete the connection before they are timed out.
- sv_maxclients: The maximum number of players allowed on the server at the same time.
3. License Key & Steam Web API
set steam_webApiKey none
sv_licenseKey cfxk_XXXXXXXXXhPXXXXXXX_XXXXX7
- steam_webApiKey: Allows Steam integration if needed. Here it is set to
none
. - sv_licenseKey: Your FiveM license key from cfx.re. Without a valid key, the server will not run.
4. Server Identity and Language
sets sv_hostname "My awesome fivem server"
sets sv_projectName "My awesome fivem server"
sets sv_projectDesc "My awesome fivem project"
sets locale "da-DK"
load_server_icon Logo.png
sets sv_enforceGameBuild 3095
- sets sv_hostname: The name of your server as displayed in the server list.
- sets sv_projectName & sv_projectDesc: Additional descriptions that scripts can reference, or simply info for the server admin.
- sets locale: Defines the primary language (here “da-DK” for Danish).
- load_server_icon: Loads a PNG file (
Logo.png
) as your server icon. - sets sv_enforceGameBuild: Requires clients to run a specific GTA build (e.g., 3095). Certain resources may depend on this.
5. Voice Settings
# Voice config
setr voice_useNativeAudio true
setr voice_useSendingRangeOnly true
setr voice_defaultCycle "GRAVE"
setr voice_defaultVolume 0.3
setr voice_enableRadioAnim 1
setr voice_syncData 1
- setr voice_*: These variables control the built-in FiveM voice chat: keys, default volume, radio animations, etc.
- GRAVE: Typically the
`
(backtick) key on a QWERTY keyboard.
6. QBCore Language Setting
# QBCore locale config
setr qb_locale "en"
- setr qb_locale: Specifies the language used by QBCore-based scripts and menus.
7. Additional Configuration & Permissions
exec perms.cfg
- exec perms.cfg: Lets you run a separate config file, often used to define admin or moderator roles.
8. Default Resources
# These resources will start by default.
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
ensure baseevents
- ensure: Starts a resource if it is not already running. These are FiveM’s basic resources for spawn, session management, chat, etc.
9. Custom Resources
# QBCore & Extra stuff
ensure ox_lib
ensure qb-core
ensure ram_monitor
ensure chat
ensure qb-multicharacter
ensure cd_drawtextui
ensure qb-target
- QBCore and Extra Scripts: These
ensure
lines make sure all necessary resources and scripts are started. Bracketed folder names (e.g.,[qb]
,[illegal]
) help keep the structure organized.
10. Database Connection
set mysql_connection_string "mysql://username:password@server.pineriver.net:3306/database_name"
- set mysql_connection_string: Defines the URI for your MySQL database, typically in the format:
mysql://username:password@host:port/databasename
. - Make sure the username, password, and hostname are correct.
Best Practices and Tips
- Backup: Always keep a copy of your
server.cfg
in case you need to restore it. - Use Comments: Use
#
to organize your configuration and add short descriptions about what each change does. - Check Dependencies: Ensure resources start in the correct order (e.g.,
qb-core
beforeqb-policejob
). - Restart After Changes: The server must be restarted after every edit to
server.cfg
. - txAdmin Settings: If you use txAdmin, certain settings (like
onesync
) should be configured there instead of inserver.cfg
.
Looking for Hosting or Support?
If you need stable FiveM hosting or help with configuration, we offer:
- High-performance FiveM hosting
- A user-friendly control panel
- 24/7 support for setup and technical questions
CTA: Ready to get started or upgrade your FiveM server? Check out our FiveM hosting plans here.
Need More Help?
- Visit our Support Center
- Live chat in your game panel
With a properly configured server.cfg
, your FiveM server will run more reliably and be easier to manage. Have fun!