Convert ESX to Qbcore

How do I convert ESX scripts to QBCore?
I’m aware that you have to change the Natives to QBCore natives right? But is that it? Can someone give me some guidance? The only video or link I found is in Hindu or something.

7 Likes

Hey :slightly_smiling_face:
Technicaly they are not Natives, they are methods/functions provided by the framework.
Other than that you’re pretty much right regarding what you need to do in order to convert an ESX script into a QBcore script.

  • First check the manifets (fxmanifest.lua) there will be some things to add or remove.
    If it’s related to ESX you remove, if there seem to be a dependency or a file missing for QBcore then add it (take a quick look at manifest from scripts from both).

  • After that replace the lines of code used to get the shared Object (client and server side) :

Citizen.CreateThread(function()

    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(100)
    end
	
end)

to :

local QBCore = exports['qb-core']:GetCoreObject()
  • Then you can get to the main part of the work, you need to replace each method by it’s QB equivalent, each framework event by it’s QB equivalent , change from MysqlAsync to Oxmysql when there is SQL query. There will be some case where you won’t have an equivalents in that case you have to restructure the code in order for it to fit.

    • For example (regarding the need to restrucutre some code), the database tables won’t have the same structure (for the user, proprety etc… for example). The Player object won’t have exactly the same structure either (you might need to change the key or index when trying to access a value from it). And so on …
7 Likes

Thank you very much for the in depth answer. Definitely appreciated. Do you have any good references for a function list or trigger list for qb ?

No problems :wink:

The best way in my opinion is to compare the two docs and take time to ready through them and through some code (knowing one or both framework well in the first place is a plus I must admit).

screen109
[Introduction | QBCore Framework]


https://esx-framework.github.io/

I figured I should just compare the functions & replace according to the opposites standards.
I needed those links for the index of functions. Thank you very much.

hi im very new to this stuff is there any videos showing how to do this or many a converter tool i could use

Hey :slight_smile:
None that I know of. A converter tool seems very very unlikely, video wise you can check on youtube that’s your best bet but if you are very new even with a video that will be quite a challange.

I have found this which seems like a good help. Saves you reading everything from both docs and it’s straight to the point of what’s what

can use esx scripts in qbcore server

Contact Me building a superfly server.

What do you do with it? drag and drop in the ESX folder?

i need yourself brother