ox_lib Integration
Flux UI Pack can replace ox_lib’s default UI components. When connected, all resources using ox_lib will automatically use Flux UI instead.
Setup
Method 1: Modify ox_lib init.lua (Recommended)
Add the following code at the end of ox_lib/init.lua:
local FLUX_RESOURCE <const> = "flux-ui-pack"
if GetResourceState(FLUX_RESOURCE) == "missing" then return end
local success, err = pcall(function()
local code = LoadResourceFile(FLUX_RESOURCE, "init.lua")
if code then
load(code)()
end
end)
if not success then
error(("Failed to load flux-ui-pack. Error: %s"):format(err))
endThis automatically loads Flux UI for all resources using ox_lib. No need to modify every resource’s fxmanifest.lua.
Method 2: Per-Resource fxmanifest (Legacy)
If you prefer not to modify ox_lib, add the following to each resource’s fxmanifest.lua that uses ox_lib:
shared_scripts {
'@ox_lib/init.lua',
'@flux-ui-pack/init.lua'
}Note: Do NOT add this into ox_lib itself. It must be added to every resource that uses ox_lib UI functions.
Ensure Order
Make sure ox_lib starts before flux-ui-pack in your server.cfg:
ensure ox_lib
ensure flux-ui-packCalling Styles
When ox_lib is present, all three calling methods work:
-- ox_lib global function
lib.showContext('menuId')
-- ox_lib export
exports['ox_lib']:showContext('menuId')
-- Direct flux-ui-pack export
exports['flux-ui-pack']:ShowContext('menuId')All three methods produce the same result — use whichever style you prefer.
Last updated on