Create your own bridge
Welcome to our tutorial to help you creating your own bridge for our resources.
Please take in note that this tutorial is only working for our new bridge system. If you have an old resource from our store, the bridge system is not the same.
So, let's start !
If you use another framework than ESX or QBCORE or you use a specific or modified version of these, you may need to create your own bridge.
Please note that creating a bridge requires a minimum of development skills and lua syntax.
Step #1 : Copy the example bridge
In your resource you have a "bridge" folder. In this "bridge" folder you have several lua files. Create a lua file named cl_yourBridgeName.lua and another named sv_yourBridgeName.lua. In each of the files, copy and paste the contents of cl_example.lua and sv_example.lua respectively
Step #2 : Initialize your bridge
In your client and server bridge file (cl_yourBridgeName.lua and sv_yourBridgeName.lua) you have something like that :
Replace the "EXAMPLE" to your framework name. For example, in the esx bridge, we've put "ESX" and for qbcore bridge, we've put "QBCORE". This is the name you have to call in the configuration.
After that, if your want to use the "auto_detect" system in the script configuration, you have to change this function below :
To make your bridge for your custom framework automatically be detected, you have to change the function logic to something that return a true value when the bridge should work and a false value when the bridge should not work. For example, in the ESX bridge, we have added some code to check if the resource with the name es_extended is started on the server and if the resource is started the function return true, otherwise, it return false.
If you just don't want to use the "auto_detect" system you can just leave the function by default, but you will have to not skip the Step #4 : Configure your config.lua file for your bridge
Step #3 : Create your bridge
We are not going to explain here precisely how to create the bridge, use your knowledge of your framework and the lua to create your bridge. Each bridge is different from each other. All information is given in the example bridge
Step #4 : Configure your config.lua file for your bridge
Go to your resource's config.lua file, and replace this Config.bridge = "A_VALUE"
with this Config.bridge = "YOUR_BRIDGE_NAME"
Step #5 : Start your server and enjoy !
Last updated