nc_bridge — configuration guide
nc_bridge has no config.lua of its own: the lib/ files read the configuration of the resource that includes them (Config.Bridge, Config.UI, Config.Locale, Config.Debug). Missing keys use the value 'auto' or the default of the table below, never an error. Every NC resource can have different values (for example nc_party with ox_lib notices and nc_dungeon with NUI toasts). The other keys are explained in each NC resource's guide; function signatures are in API.md.
Start
In server.cfg nc_bridge must start before the NC resources:
ensure nc_bridgeConfig.Bridge keys
| Key | Values | Default | What it does |
|---|---|---|---|
Config.Bridge.Framework | 'auto', 'qbx', 'qb', 'esx', 'standalone' | 'auto' | framework used; forced but not started = warning + auto |
Config.Bridge.Name | 'character', 'player' | 'character' | name shown to others: framework character or FiveM name |
Config.Bridge.LocaleFromGame | true, false | false | texts in the player's game language, when the resource has it |
Config.Bridge.Inventory | 'auto', 'ox_inventory', 'qb-inventory', 'framework', 'none' | 'auto' | where items and money go |
Config.Bridge.Notify | 'nui', 'gta', 'ox_lib', 'okokNotify', 'framework', 'qbx', 'qb', 'esx', 'auto' | 'nui' | where notices show |
Config.Bridge.NotifyMs | milliseconds | 4500 | how long a notice stays |
Config.Bridge.NotifyTitle | text | empty | title of okokNotify notices |
Config.Bridge.Xp | 'auto', 'nc_rift', 'kvp', 'framework', 'custom', 'none' | 'auto' | where XP goes |
Config.Bridge.XpMetaKey | text | '<resource>_xp' | metadata key of mode 'framework' |
Config.Bridge.Death | 'auto', 'ml_healthsystem', 'framework', 'native', 'custom', 'none' | 'auto' | how a player is revived |
Config.Bridge.DeathMeta | true, false | true | also counts as dead from framework metadata |
Config.Bridge.DeathPedHealth | true, false | true | also counts as dead with ped health <= 100 |
Config.Bridge.Party | true, false | true | false = do not use nc_party even when it is started |
Example (in the NC resource's config.lua):
Config.Bridge = {
Framework = 'auto',
Inventory = 'ox_inventory',
Notify = 'ox_lib',
Xp = 'kvp',
Death = 'auto',
}Old keys still read (for nc_party, nc_dungeon and nc_rift configs already installed): Config.UI.Notify (when Config.Bridge.Notify is missing), Config.UI.NotifyMs, Config.Xp.Provider and Config.Xp.metaKey (when Config.Bridge.Xp and Config.Bridge.XpMetaKey are missing), Config.Death.revive (when Config.Bridge.Death is missing), Config.UI.followRift and Config.UI.followParty (themes). Config.Xp.enabled = false turns off the resource's XP.
Inventory
With 'auto' the order is ox_inventory, then qb-inventory, then the framework inventory (Qbox / QBCore / ESX), then 'none'. A forced value that is not available = 'none' + a console warning: no item is given and the resource reports it. Money goes to the framework ('cash' / 'money', 'bank', 'black_money'); without a framework, with ox_inventory, cash becomes the money item. For another inventory use 'framework' if it hooks into your framework; the functions the resource uses are NCB.GiveItem, NCB.RemoveItem, NCB.GiveMoney and NCB.GiveReward in API.md.
Notices
Order: Config.Integrations.notify when that resource is started, then Config.Bridge.Notify (or Config.UI.Notify). 'nui' = own toasts in the resource's theme (they also show Chinese, Japanese and Korean); 'gta' = GTA feed (no Chinese, Japanese and Korean); 'auto' = ox_lib, then okokNotify, else 'nui'. A system that is not started = 'nui' + a warning. For your own HUD:
Config.Integrations = {
notify = { resource = 'my_hud', export = 'notify' },
}The export is called with (text, kind); kind = 'info', 'success', 'warning' or 'error'. In an open file of the resource, loaded after nc_bridge, you can set the hooks NCB.NotifyKind (kind per code), NCB.NotifyArgs(code, args) (changes the arguments) and NCB.NotifyHook(code, args) (true = you handle the notice and nc_bridge does not show it).
Death and revive
With 'auto': ml_healthsystem when started, then the framework medical system (Qbox / QBCore / ESX), else 'native' (nc_bridge's own revive). With ml_healthsystem started only its state bag deathState decides. Otherwise a player counts as dead (or down) with any of: state bags deathState, isDead, inLastStand, inlaststand, dead, framework metadata (can be turned off with Config.Bridge.DeathMeta), ped health <= 100 (can be turned off with Config.Bridge.DeathPedHealth). For your own medical system use Config.Bridge.Death = 'custom' and the hooks:
NCB.DeadCustom = function(src)
if exports.my_medical:IsDead(src) then return 'my_medical' end
return false
end
NCB.ReviveCustom = function(src, pos)
exports.my_medical:Revive(src)
endWhen set, NCB.DeadCustom alone decides who is dead (with every mode); an error inside a hook = normal checks or native revive + a console warning.
XP
With 'auto' (same as 'nc_rift') XP goes to nc_rift when started, else to the resource's KVP (key <resource>:xp:<character>). 'framework' = character metadata (key Config.Bridge.XpMetaKey); 'none' = no XP. For your own level or skill resource use Config.Bridge.Xp = 'custom' and the hooks:
NCB.XpCustomGive = function(src, amount, ctx)
return exports.my_skills:AddXp(src, amount)
end
NCB.XpCustomGet = function(src)
return exports.my_skills:GetXp(src)
endNCB.XpCustomGive returns the new total; nil or an error = the XP goes to the KVP + a warning.
Party and loot
lib/party.lua uses nc_party only when it is started: party members and loot split with the loot mode the party chose. Without nc_party, without a party or with Config.Bridge.Party = false everything goes to whoever did the action.
Debug
With Config.Debug = true (or the resource's debug command) trace lines go to the resource's data/debug.log (last 500). The data/ folder must exist in the resource.
Common problems
- Load error of an
@nc_bridge/...file at start: nc_bridge is missing or not started first; check the folder and theensureorder. - Warning
Config.Bridge.Inventory = "..." is not available: the inventory you wrote is not started; set'auto'. - Warning
notify "..." is not available: the notice system you wrote is not started; NUI toasts are used. - Warning
is older than the required: another resource brought an older nc_bridge; keep the newest.
The full guide in 9 languages is also in the resource's docs/ folder.