π§© Creating a Custom Framework Bridge
Dream Bridge supports ESX, QBCore, and QBX out of the box. If you're using a different or modified framework, you can implement your own custom bridge to ensure compatibility.
This guide walks you through creating a new bridge using the built-in custom template provided.
π‘ Note: QBX (Qbox) is fully compatible with the QBCore bridge. No separate implementation needed.
π Bridge Structureβ
All bridges are located in the bridge/ folder.
Each framework (e.g., esx, qbcore, custom) has its own subfolder with:
client.luaserver.lua
The bridge automatically detects your active framework via GetResourceState.
Important: If your framework resource is renamed (e.g.,
es_extendedβroleplay_framework), auto-detection may fail.
π How to Use the custom Bridgeβ
Use the custom bridge:
- You're using a standalone or unofficial/unsupported framework
β‘οΈ Create a new bridge based on thecustomtemplate. - You need to edit/change something in an existing bridge.
β‘οΈ Try to edit the existing bridge first. e.g. Your owned_vehicles table is different from the default one. In this case you just need to edit the vehicle related functions in the existing bridge. No need to create a new one or edit all. - No supported framework is detected by default.
β‘οΈ If you've renamed your framework resource, it may not be detected automatically (e.g.es_extended->roleplay_framework). In this case, you need toGetResourceStateto your renamed resource in the correct bridge file.
π οΈ Getting Startedβ
- Copy the
bridge/customfolder
Rename it to match your custom framework name (e.g.,bridge/myframework). - Modify both
client.luaandserver.lua
Implement your logic in the provided function stubs. - Adjust the framework detection logic
Replace or extend theGetResourceStatechecks to detect your custom framework.
β
Example: client.lua
if GetResourceState('my_framework') ~= 'started' then return end
DreamFramework.ServerFramework = 'myframework'
DreamFramework.ServerFrameworkLoaded = true
function DreamFramework.showHelpNotification(text)
-- Your custom help display code
end
function DreamFramework.getPlayerJobName()
return exports['my_framework']:GetJobName()
end
β
Example: server.lua
if GetResourceState('my_framework') ~= 'started' then return end
DreamFramework.ServerFramework = 'myframework'
DreamFramework.ServerFrameworkLoaded = true
function DreamFramework.getPlayerFromId(source)
return exports['my_framework']:GetPlayer(source)
end
function DreamFramework.getPlayerMoney(source, account)
local player = DreamFramework.getPlayerFromId(source)
return player.money or 0
end
π§ What Functions to Implement?β
Your bridge must implement all functions included in the custom template and all other bridges. This includes:
- Player functions (e.g.,
getPlayerFromId,getPlayerName) - Job management
- Inventory & money
- Vehicle ownership
- Events like
OnPlayerLoaded,OnPlayerJobChange - Any other functions that the bridge has...
Check the
bridge/custom/client.luaandbridge/custom/server.luafiles for the full list of required functions.
Every single function in the bridge template must be implemented in your custom bridge.
If even one function is missing, your framework will likely throw multiple errors, break scripts relying on those functions, and cause unexpected behavior.
β‘οΈ Double-check bridge/myframework/client.lua and bridge/myframework/server.lua to ensure full function coverage.
Missing functions = broken experience.
β° Event Handlingβ
Some events must be triggered manually for compatibility:
RegisterNetEvent('myfw:playerLoaded', function(playerId)
OnPlayerLoaded(playerId)
end)
RegisterNetEvent('myfw:jobChanged', function(playerId, newJob)
OnPlayerJobChange(playerId, newJob.name)
end)
π¬ Tipsβ
- Use logs like
print("[Bridge] Loaded custom bridge")for easier debugging. - Test each function individually in a controlled environment.
- Make use of the
customfolder as a base β it's already pre-filled with all required stubs.
π Contribute Your Bridgeβ
Made a working bridge for your own framework?
Feel free to share it with us β help others benefit from your integration!
π§ Your contribution can become part of the official project, and you'll get full credit for your work.
π‘ If you have any questions or need help, feel free to reach out to us on our Discord server.
Happy coding! π