GIG ScriptsGIG Scripts

The bridge

How our resources talk to your framework, inventory and other scripts.

Every resource has a bridge/ folder. Nothing in there is specific to what the resource does; it only translates between the resource and the rest of your server. Because it is open code, you can read it, change it, or add a file for something we do not support.

How detection works

The bridge is split into small files, one per system:

bridge/
├── client/
│   ├── framework/   qbox.lua  qb.lua  esx.lua  fallback.lua
│   ├── inventory/   ox.lua  qs.lua  qb.lua  esx.lua  fallback.lua   (only where the client reads items)
│   ├── notify.lua
│   ├── textui.lua
│   └── target.lua
└── server/
    ├── framework/   qbox.lua  qb.lua  esx.lua  fallback.lua
    ├── inventory/   ox.lua  qs.lua  qb.lua  esx.lua  fallback.lua
    └── notify.lua

Each file starts with the same check. If the config forces a system, only that file loads. On auto, the file loads when its resource is started, and the first match wins. fallback.lua loads last and fills in stubs so the resource still starts, with an error in the console telling you what was not found.

local forced = cfg.framework
if forced and forced ~= 'auto' then
    if forced ~= 'qb' then return end
elseif GetResourceState('qb-core') ~= 'started' or GetResourceState('qbx_core') == 'started' then
    return -- Qbox wins when its qb-core shim is also running
end

Qbox ships a qb-core compatibility resource. The bridge knows about that and picks Qbox when both are started.

Framework

Order of detection: qbx_core, then qb-core, then es_extended.

The framework files provide the player lookups (identifier, name, job), money, the player loaded and logout events, and usable item registration. Usable items are registered through the framework on purpose: ox_inventory calls the framework's usable item callbacks, so you do not need to add client.export lines to items.lua.

Inventory

Order of detection: ox_inventory, then qs-inventory. When neither is started, the framework's own item functions are used (qb.lua for QB-Core, esx.lua for ESX). That also covers qb-inventory, ps-inventory and lj-inventory, since they all go through qb-core's player functions.

Notifications

cfg.notify picks the notification script. Supported values: ox (ox_lib, the default), qb, esx, okok, sd, wasabi, 17mov, codem. Some resources also have cfg.textUI (ox, qb, esx, okok) and cfg.target (ox for ox_target, qb for qb-target).

Using something we don't support

Open the fallback.lua for the side you need and fill in the functions. Every function has a one-line comment above it saying what it must return. Then force the config to skip detection:

cfg.framework = 'none'

Or, if you prefer, copy qb.lua to a new file, adapt it, and add it to the client_scripts / server_scripts lists in fxmanifest.lua before fallback.lua.

Changes to bridge/ survive updates only if you copy them over. Keep a note of what you changed.

On this page