FiveM scripts · Cortex Lib

Install Cortex Lib

Folder name, start order, the optional quick menu, first checks, updates, and troubleshooting for server owners.

8 sections · 4 min read

Before you start

Cortex Lib provides shared settings, notifications, menus, and interaction prompts for Cortex resources. Install it once and start it before every script that needs it. Cortex Lib is free on Tebex, and the download includes its MIT-licensed source.

It needs no framework, database, Node.js, or frontend build. The interface, React, and fonts are bundled. It does not replace ox_lib, ESX, or QBCore when another resource requires them.

Use the library version your script requires. Cortex PolCam 1.0.2 needs Cortex Lib 2.2.1. The older 2.2.0 package does not contain the shared presentation files PolCam uses.

RequirementDetails
RuntimeFiveM server, GTA V, cerulean
Folder nameExactly cortex-lib
Start orderBefore every script that depends on it
Framework or databaseNone
CopiesOne per server, even when several scripts use it

Add the resource

Keep every file from the package. fxmanifest.lua must sit directly inside cortex-lib. A category folder such as [cortex] is optional.

Avoid nested folders such as cortex-lib/cortex-lib/fxmanifest.lua.

  1. Extract the complete cortex-lib folder into your server's resources directory.
  2. Check that no second copy of cortex-lib exists in another resource category.
  3. Add cortex-lib to server.cfg above every resource that depends on it.
Folder layout (partial)
resources/
└── [cortex]/
    ├── cortex-lib/
    │   ├── fxmanifest.lua
    │   ├── init.lua
    │   ├── client/
    │   ├── imports/
    │   ├── resource/
    │   └── ui/
    └── cortex-polcam/

Set the start order

Start the library first, then each Cortex resource you use. Keep the resource folder names unchanged. A resource that loads the library before it starts stops with the error "cortex-lib must be started before this resource".

server.cfg
ensure cortex-lib

# Cortex resources start after the library. List only the ones you use.
ensure cortex-polcam
ensure cortex-chat

Choose the Escape behaviour

The Cortex quick menu is off by default. Escape keeps opening GTA's pause menu, or the menu supplied by another resource. No configuration is needed for that.

Only the server owner can turn the quick menu on. Set the value before ensure cortex-lib. Players cannot change it in Cortex Settings. You can also run the setr line in the server console to change it immediately; keep the same value in server.cfg so it survives a restart.

Leave cortex_debug at 0 on a live server. It enables a development command that exposes test actions.

server.cfg
# 0 keeps the native or other pause menu (default). 1 enables the Cortex quick menu.
setr cortex_pause_replace_native 1

# Quick menu title, up to 48 bytes. Default CORTEX.
setr cortex_pause_title "CORTEX"

# Keep development diagnostics off.
setr cortex_debug 0

ensure cortex-lib

Check your first session

After a new installation, restart the server or run these commands in the server console. Replace the second resource name with your script's folder name.

  1. Join the server and enter /cortexsettings in chat.
  2. Confirm Cortex Settings opens, then close it with Escape.
  3. Check that control returns to the game.
  4. Check the dependent script's main feature.
  5. Check the server console and the player's F8 console for errors.
Server console
refresh
ensure cortex-lib
ensure cortex-polcam

How player preferences are saved

Each player's preferences are stored on their own computer in FiveM client storage. They are not shared between players and do not follow a player to another computer.

Updating or reinstalling the library does not reset them. Returning players may see different values from a fresh installation. Saved FiveM key bindings also survive updates.

Update the library

This version needs no SQL migration. Keep the previous library and script versions together if you need to roll back.

  1. Check the library version each dependent script requires.
  2. Back up the cortex-lib folder and any local changes.
  3. Stop dependent scripts before replacing files.
  4. Replace the complete cortex-lib folder. Do not mix files from different releases.
  5. Start cortex-lib, then restart its dependent scripts.
  6. Check settings, notifications, and each script's main feature.
Server console
restart cortex-lib
restart cortex-polcam

Troubleshooting

Avoid deleting a player's FiveM storage to fix one preference. Change it in Cortex Settings or the native key binding menu first.

ProblemWhat to check
Server cannot find cortex-libUse the exact folder name with fxmanifest.lua directly inside. Run refresh after installing.
A script says cortex-lib must start firstMove its ensure line below cortex-lib and restart in that order.
Missing export or presentation-client.luaCheck the required library version and replace the whole folder. PolCam 1.0.2 needs 2.2.1.
Lua 5.4 is requiredThe script loading the library must declare lua54 'yes' in its fxmanifest.lua. Ask its author for a compatible build.
Blank or missing interfaceCheck F8 for errors. Keep ui/, ui/vendor/, and the manifest from the same package.
Escape opens an unexpected menuCheck server.cfg for setr cortex_pause_replace_native 1. Set it to 0, and check other pause menu resources.
A menu will not openClose the GTA pause menu or any other focused interface, then try again.
A script's settings page is missingConfirm the script supports shared settings and started without errors. Restart it after cortex-lib.
A preference revertedUse Apply or Save & Resume. Discard & Resume and Escape restore earlier values.
Controls stay stuck after closingNote which menu and action caused it, check F8, then restart cortex-lib and the affected script.