The Lab
Install guide

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.

Estimated time: 10 min

Before you start

  • Access to server.cfg
  • A list of the resources your server runs

Install steps

  1. 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-core or redem_roleplay is started) choose a fallback if they boot first. Resources listed in dependencies are started first when they exist, but plain export calls and detection are not covered by that.

  2. 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-id
  3. Step 3: Split long files with exec

    Large servers keep server.cfg short and move resource lists into separate files loaded with exec. The order still applies across files: the file executed first starts first.

    exec resources/framework.cfg
    exec resources/scripts.cfg
  4. Step 4: Check each script's needs

    Open its fxmanifest.lua: dependencies, and any @resource/... path in server_scripts or client_scripts, name resources that must start first. The script's README usually gives the exact ensure lines.

  5. 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.