RedM server.cfg ensure order
FXServer starts resources in the order their ensure lines appear in server.cfg. Most "works after a restart, broken on boot" problems come from that order. Here is the rule, a layout that works for every framework, and how to check a script's needs.
Before you start
- Access to
server.cfg - A list of the resources your server runs
Install steps
Step 1: Understand why order matters
A resource that calls another one's exports while starting fails if that one is not running yet. Scripts that detect your framework (they check whether
vorp_core,rsg-coreorredem_roleplayis started) choose a fallback if they boot first. Resources listed independenciesare started first when they exist, but plain export calls and detection are not covered by that.Step 2: Use layers
Group your lines in this order: server settings and convars, the database driver, shared libraries, the framework core, framework modules (inventory, metabolism, characters), then everything else. Maps and streamed assets can go anywhere after the base.
# 1. settings and convars set gamename rdr3 set mysql_connection_string "mysql://user:password@localhost:3306/redm" # 2. database driver ensure oxmysql # 3. libraries your framework needs # ensure ox_lib # 4. framework core and modules # ensure vorp_core / rsg-core / redem_roleplay # ensure <inventory>, <metabolism>, ... # 5. your scripts ensure tlb-hud ensure tlb-idStep 3: Split long files with exec
Large servers keep
server.cfgshort and move resource lists into separate files loaded withexec. The order still applies across files: the file executed first starts first.exec resources/framework.cfg exec resources/scripts.cfgStep 4: Check each script's needs
Open its
fxmanifest.lua:dependencies, and any@resource/...path inserver_scriptsorclient_scripts, name resources that must start first. The script's README usually gives the exactensurelines.Step 5: Verify after a cold boot
Stop and start the whole server, not just the resource. Reading the startup log from top to bottom shows the real order and the first error.
Troubleshooting
"No such export" in the console at boot
The resource providing the export starts later. Move its ensure line higher.
A multi-framework script runs in standalone mode
It booted before your framework core. Move it down, or set its framework option explicitly.
Database errors right after boot
oxmysql is not first, or the connection convar is set after ensure oxmysql.
FAQ
Doesn't the dependencies list in fxmanifest handle this?
Partly. Listed dependencies are started first when they exist. Scripts that detect your framework do not list every framework as a dependency, so their position in server.cfg still matters.
Can I ensure a whole category folder?
Write one line per resource. That keeps the order explicit and easy to review.
Related guides
- How to install a RedM scriptInstall any RedM resource: get the files, check fxmanifest dependencies, add SQL and items, place the ensure line and test from the console.
- Install oxmysql on RedMSet up oxmysql for RedM: download the release build, set mysql_connection_string, ensure it first and fix the usual connection errors.
- Set up a RedM server with txAdminCreate a RedM server with txAdmin: FXServer artifacts, Cfx.re license key, gamename rdr3, OneSync and a deployment for your framework.