F.A.Q
Setup
- Ensure
ox_libis started beforeml_bridgeinserver.cfg - Verify
ml_bridgefolder exists in resources - Check console for dependency errors
- The inventory resource must be started before
ml_bridge - Check that the resource name matches exactly (e.g.
ox_inventory, notox-inventory) - Set
Config.Debug = trueand check the detection log
Set the corresponding config value instead of 'auto':
1Config.Inventory = 'ox'
2Config.Target = 'ox'
3Config.Fuel = 'LegacyFuel'Framework
QBCore, QBox (qbx_core), ESX, and Standalone. Detection is automatic based on which core resource is running.
Yes. Set Config.Framework = 'auto' or force 'standalone'. Functions that require framework data (jobs, gangs, metadata) return default/nil values.
On player load, ml_bridge caches identifiers (license, discord, steam), character ID, RP name, and job. This data is cached for instant access during logging without additional DB queries.
Inventory
ox_inventory, qb-inventory, lj-inventory, ps-inventory, qs-inventory, codem-inventory, core_inventory, origen_inventory, tgiann-inventory. All are auto-detected.
Replace direct inventory calls with Bridge functions:
1-- Server
2local has = Bridge.HasItem(source, 'lockpick', 1)
3Bridge.RemoveItem(source, 'lockpick', 1)
4Bridge.GiveItem(source, 'bread', 5)
5
6-- Client
7local has = Bridge.HasItem('lockpick', 1)It gives as many items as the player can carry using a binary search on CanCarry. Returns two values:
1local success, actualAmount = Bridge.GiveItemToFit(source, 'bread', 10)
2-- If inventory can only hold 7, actualAmount = 7Target
ox_target, qb-target, sleepless_interact. If none are found, falls back to text-based UI ('textui').
1Bridge.AddEntityTarget(entity, {
2 label = 'Search',
3 icon = 'fas fa-search',
4 distance = 2.0,
5 onSelect = function()
6 print('Searched!')
7 end
8})Logging
Bridge.Log checks Config.LogProvider and sends to one or more backends:
'discord': Discord webhook embeds'ox_lib': ox_lib logger'fivemanage': FiveManage HTTP API'both': Discord + FiveManage'all': All three
Logs are batched and sent every 60 seconds to avoid rate limits.
In any ML script's config, set the webhook to false:
1Config.Log = {
2 AdminRevive = 'https://discord.com/api/webhooks/...',
3 PlayerDeath = false, -- disabled
4}Dispatch
ps-dispatch, cd_dispatch, qs-dispatch, op-dispatch, rcore_dispatch, origen_police, bub-mdt, lb-dispatch, wasabi_mdt, tk_dispatch, fd_dispatch, emergencydispatch. If none are detected, ml_bridge provides its own fallback system that creates a timed map blip (2 min) and shows a phone-style notification.
1Bridge.AlertDispatch({
2 message = 'Store Robbery',
3 description = 'Armed robbery in progress',
4 coords = GetEntityCoords(cache.ped),
5 jobs = { 'police' },
6 code = '10-31',
7 blip = { sprite = 58, scale = 1.0, color = 1, flash = true },
8})Minigames
Three types:
- KeySequence: Press random keys in order. Supports a hidden mode where upcoming keys are scrambled
- HoldKeySequence: Multiple rows of keys that must be held for a duration. Supports parallel rows
- ProgressBar3D: A 3D world-space progress bar with fade in/out
All three render in 3D at world coordinates, not in screen space.
Callbacks
Server registers a named handler with Bridge.OnServerRequest. Client calls Bridge.RequestServer which yields the coroutine until the server responds (10s timeout).
The secure flag prevents other resources from invoking a callback registered by your script.
1-- Server
2Bridge.OnServerRequest('myData', function(src, key)
3 return MySQL.query.await('SELECT ...', { key })
4end, true)
5
6-- Client (inside CreateThread)
7local result = Bridge.RequestServer('myData', 'someKey')Spatial
Spatial is a client-side sector-based proximity system. It divides the map into 200m sectors and only checks nodes in the player's current sector, making it efficient for tracking many points simultaneously.
Use Spatial.Track(id, coords, distance, onEnter, onExit) to register a point. The loop starts automatically.
Waypoints
DUI (Direct UI) textures are rendered directly into the 3D world. Pooling means DUI instances are created once and reused. When a waypoint goes offscreen, its DUI is returned to the pool. When a new waypoint needs rendering, it grabs an existing DUI from the pool instead of creating a new one. This keeps GPU memory constant.
Minimal impact. Only waypoints visible on screen acquire a DUI. Offscreen waypoints cost zero. Visibility checks run every 100ms. The DUI pool prevents texture creation and destruction overhead.
Yes. Server exports send waypoint data to specific players, groups, or all players:
1-- For one player
2exports.ml_bridge:WaypointCreate(source, data)
3
4-- For everyone
5exports.ml_bridge:WaypointCreate(-1, data)Updates
- Download latest from CFX Portal
- Backup
config.luaandconfig_server.lua - Replace all files except config
- Restart the resource
No database, no migration needed.