How To Build A GTA FiveM Server
What is Grand Theft Auto 5: FiveM
FiveM ( previously known as Five Reborn) is a continuance of FiveM. Custom Grand Theft Auto: 5 Servers, Play on massive servers with full Modding capability, edit your server easily, custom gamemodes, vehicles, and weapons, your world, your choice. The platform allows you to run dedicated functional servers which re-create the complete GTA: Online experience.
The platform will provide you with the complete GTA:Online experience will also allow you to develop your own understanding even further in using plugins, other maps, and/or scripts.
Setting up a server
Make sure you have registered a license key on the Cfx.re Keymaster service. You need to have the IP match the public IP on which you’re going to first use the key. Afterwards, the key can be used on any IP, but only on one server at a time.
- Download and install Visual C++ Redistributable 2019 or newer.
- Go to the artifacts server.
- Download the latest recommended build.
- Open the
server.zipyou just downloaded.
- Extract it somewhere you want to store it. We’ll pick
- Open the folder you just extracted it to. It should look a little like this:
- Double click
- This site should open in your browser. Make sure a PIN is filled, and click
- Log in to your account on Cfx.re in this tab and then click
- Set a password to log in to your server’s admin page.
- Click ‘Next’.
- Type a name for your server and click ‘Next’.
- Select to use a ‘Popular Template’.
- Pick the ‘CFX Default’ template for now. Other templates may exist, but some will require a database server.
- Click ‘Save’ or select another path.
- Go to the ‘Recipe Deployer’.
- Click ‘Next’ once you’re sure the recipe looks fine. It should be fine the way it comes.
- Enter the key you just made on the Keymaster in the ‘Before you begin’ step and click ‘Run Recipe’.
- If everything’s correct, you can click ‘Next’ again.
- … and finally, “Save & Run Server”, and you’re done!
Linux installation steps
Note that the Linux version of FXServer is only provided as a courtesy port due to issues regarding Linux distribution compatibility and availability of diagnostic tools for native C++ code. If you’re experiencing any issues, you’re more likely to see them fixed if you use the Windows version.
- Create a new folder (for example
mkdir -p /home/username/FXServer/server), this will be used for the server binaries.
- Download the current recommended
masterbranch build for Linux from the artifacts server(copy the URL for the latest server version and use
wget <url>to download it).
- Extract the build to the directory that was previously created, using
cd /home/username/FXServer/server && tar xf fx.tar.xz(you need to have
xzinstalled, on Debian/Ubuntu this is in the
- Clone cfx-server-data in a new folder outside of your server binaries folder.
4b. For example
git clone https://github.com/citizenfx/cfx-server-data.git /home/username/FXServer/server-data
- Make a server.cfg file in your
server-datafolder (copy the example server.cfg file below into that file).
- Set the license key in your
- Run the server from the
bash /home/username/FXServer/server/run.sh +exec server.cfg
- If you don’t get any ‘resources found’, and it says ‘Failed to start resource’, you didn’t ‘cd’ to the right folder.
- If no resources get started, and you can’t connect, you didn’t add +exec.
- If you get ‘no license key was specified’, one of the above things applies.
An example server.cfg follows.
# Only change the IP if you're using a server with multiple network interfaces, otherwise change the port only. endpoint_add_tcp "0.0.0.0:30120" endpoint_add_udp "0.0.0.0:30120" # These resources will start by default. ensure mapmanager ensure chat ensure spawnmanager ensure sessionmanager ensure basic-gamemode ensure hardcap ensure rconlog # This allows players to use scripthook-based plugins such as the legacy Lambda Menu. # Set this to 1 to allow scripthook. Do note that this does _not_ guarantee players won't be able to use external plugins. sv_scriptHookAllowed 0 # Uncomment this and set a password to enable RCON. Make sure to change the password - it should look like rcon_password "YOURPASSWORD" #rcon_password "" # A comma-separated list of tags for your server. # For example: # - sets tags "drifting, cars, racing" # Or: # - sets tags "roleplay, military, tanks" sets tags "default" # A valid locale identifier for your server's primary language. # For example "en-US", "fr-CA", "nl-NL", "de-DE", "en-GB", "pt-BR" sets locale "root-AQ" # please DO replace root-AQ on the line ABOVE with a real language! :) # Set an optional server info and connecting banner image url. # Size doesn't matter, any banner sized image will be fine. #sets banner_detail "https://url.to/image.png" #sets banner_connecting "https://url.to/image.png" # Set your server's hostname sv_hostname "FXServer, but unconfigured" # Set your server's Project Name sets sv_projectName "My FXServer Project" # Set your server's Project Description sets sv_projectDesc "Default FXServer requiring configuration" # Nested configs! #exec server_internal.cfg # Loading a server icon (96x96 PNG file) #load_server_icon myLogo.png # convars which can be used in scripts set temp_convar "hey world!" # Remove the `#` from the below line if you do not want your server to be listed in the server browser. # Do not edit it if you *do* want your server listed. #sv_master1 "" # Add system admins add_ace group.admin command allow # allow all commands add_ace group.admin command.quit deny # but don't allow quit add_principal identifier.fivem:1 group.admin # add the admin to the group # enable OneSync (required for server-side state awareness) set onesync on # Server player slot limit (see https://fivem.net/server-hosting for limits) sv_maxclients 48 # Steam Web API key, if you want to use Steam authentication (https://steamcommunity.com/dev/apikey) # -> replace "" with the key set steam_webApiKey "" # License key for your server (https://keymaster.fivem.net) sv_licenseKey changeme
Console commands can be executed either using an RCon tool, directly from the server console interface, a server configuration file, the server command line, or (if a resource is allowed by the ACL) the ExecuteCommand function.
Adding a custom RCon command can be done using the RegisterCommand function on the server, or the (legacy)
Starts the resource specified in the argument, if it was stopped. It is also possible to specify a category name, such as
start lambda-menu start [cars]
Stops the resource specified in the argument, if it was started. As with
start, one can also specify a category name.
Restarts the resource specified in the argument, if it was started. If it wasn’t, starts the resource specified in the argument.
stop, one can also specify a category name.
Restarts the resource specified in the argument, if it was started. Also supports category names.
Rescans the resources folder and loads all resource manifests in them, also making new resources available to start using start.
Runs the commands specified in the filename. Commonly seen as
FXServer.exe +exec server.cfg.
This is provided by the rconlog resource.
Shows a list of players with their primary identifier, server ID, name, endpoint, and ping.
This is provided by the rconlog resource.
Kicks the client with the specified server ID (as seen in status) from the server, for the stated reason.
clientkick 43 You're a superstitious idiot!
This is provided by the chat resource.
Sends a message in the chat as console.
say Hi, everybody!
Opens or closes the server debug GUI.
Defines which mode of state awareness to use.
- Off: No state awareness at all, clients will use the standard GTA/RAGE P2P networking model, and the server will only function as a relay.
- On: Full state awareness and server-determined entity routing.
- Legacy: Compatibility mode for scripts that expect all players to exist on each client. Not recommended due to performance issues and graphical glitches.
A console variable that specifies the maximum amount of clients that the server can normally have, as an integer from 1 to 1024.
Values starting at 32 will require
onesync to be set to
legacy, and values above 64 will require
onesync to be set to
A boolean variable that, if true, hides player IP addresses from public reports output by the server.
A string variable that contains the server host name.
Variance is how likely the user’s id will change for a given provider (i.e. ‘steam’, ‘ip’, or ‘license’).
A console variable as an integer from 1-5 (default 1); from least to most likely to change.
Trust is how unlikely it is for the user’s identity to be spoofed by a malicious client.
A console variable as an integer from 1-5 (default 5); from least to most trustworthy (5 being a method such as external three-way authentication).
A console command which loads a specfied icon and sets it as the server icon. The icon needs to be a 96×96 PNG file.
Sets the RCon password. This being unset means RCon is disabled.
Sets a Steam Web API key, which is required to allow for Steam identifiers to be returned by the server.
Adds an access control entry to the server’s access control list.
add_ace group.admin command.potato allow add_ace identifier.steam:110000112345678 command.apple deny
Sets a principal to inherit from another principal.
# makes identifier.steam:110000112345678 inherit from group.admin add_principal identifier.steam:110000112345678 group.admin
Removes a specified ACE from the server’s access control list.
remove_ace identifier.steam:110000112345678 command.apple deny
Removes a specified principal inheritance entry.
remove_principal identifier.steam:110000112345678 group.admin
Tests if a principal is allowed or denied access to a given object.
test_ace group.admin command.adminstuff