Skip to content

cc_lib

The Code Cartel compatibility layer. One Lua API across ESX Legacy, QBCore, Qbox, ox_core, ND_Core and no framework at all — and across the inventory, banking, billing, target, notification, progress,

The Code Cartel compatibility layer. One Lua API across ESX Legacy, QBCore, Qbox, ox_core, ND_Core and no framework at all — and across the inventory, banking, billing, target, notification, progress, menu, phone, dispatch, keys, fuel, clothing, garage, door and weather resources your server already runs. Each category is detected at runtime, can be forced in config.lua, and falls back to a working built-in when nothing is installed.

Every Code Cartel script needs it. It is free, ships open source (not escrowed), and costs ~0.00 ms: it runs no threads at rest and loads only the modules a resource actually uses.

Version1.13.0 — see CHANGELOG.md
Needsnothing (FXServer with Lua 5.4; OneSync recommended)
FrameworksESX Legacy, QBCore, Qbox, ox_core, ND_Core, standalone
DocsINSTALL · CONFIG · API / exports · COMPATIBILITY · TROUBLESHOOTING

Install in 60 seconds

  1. Put the cc_lib folder in your resources (keep the name cc_lib).
  2. In server.cfg, start it after your framework and inventory and before any Code Cartel script:
    cfg
    ensure ox_lib            # if you use it
    ensure qbx_core          # or es_extended / qb-core / ox_core
    ensure ox_inventory      # your inventory, target, phone, etc.
    ensure cc_lib
    ensure cc_yourscript
  3. Restart the server and read the table cc_lib prints: it lists what it detected for every category. Type cc in the console any time to print it again.

Full steps per framework, updating and uninstalling: INSTALL.md.

What it does for you

  • Detects your stack. Framework, inventory, banking/society, billing, target, notify, progress bar, text UI, menu, skill check, phone, dispatch, vehicle keys, fuel, clothing/appearance, garages, doors and weather. 90+ resources — full list in COMPATIBILITY.md.
  • Lets you override everything. config.lua → Config.Bridge.<category> = 'my-fork' (or 'none'). Renamed forks work.
  • Never crashes your server over a missing resource. No inventory? Items fall back to the framework. No target? A native [E] prompt. No dispatch? A blip + notification for allow-listed jobs. No phone? A notification.
  • Security built in. CC.security.event gates every net event a Cartel script registers: typed arguments, cooldowns, one-in-flight locks, distance, job/gang, alive, single-use tickets, ACE admin checks. Read EXPORTS.md → CC.security.
  • Logs owners trust. Discord webhooks with batching and 429 backoff, mention-safe text, plus a local cc_lib:log event and Fivemanage / ox_lib mirrors.
  • Checks your config at boot. A typo prints one red line naming the setting; the default is used, the server keeps running. Console: cc_validate.

Configuration at a glance

FileWho reads itWhat goes in it
config.luaserver and players (public)adapter overrides, log level, locale, branding, boost window
server/config.luaserver only (secret)Discord webhook URLs
locales/*.luaserver and playersthe few strings cc_lib shows itself

Every setting also has a cc:* convar, which wins over the file — so existing server.cfg setups keep working. Reference: CONFIG.md.

For developers

lua
-- fxmanifest.lua of your resource
shared_script '@cc_lib/init.lua'
dependency 'cc_lib'
lua
-- server
CC.security.event('myjob:collect', {
    cooldown = 1000, exclusive = true, alive = true,
    args = { { name = 'index', type = 'number', integer = true, min = 1, max = #Rewards } },
}, function(src, index)
    if CC.inventory.canCarry(src, Rewards[index].item, 1) then
        CC.inventory.addItem(src, Rewards[index].item, 1)
        CC.notify.send(src, { description = 'Collected', type = 'success' })
    end
end)

Not Lua? exports.cc_lib:call('money', 'add', src, 'bank', 500, 'myjob:payout') works from JavaScript and C#. The whole API, every module and export: EXPORTS.md.

Support

Paste the output of the cc console command with every ticket — it shows your artifact, OneSync mode, gamebuild and every adapter cc_lib picked. Common errors and their fixes: TROUBLESHOOTING.md.

Licence

Free, including on commercial servers and inside your own resources. See LICENSE.md.