# Converting Scripts

{% hint style="info" %}
Remember to always include es\_extended/imports.lua to your fxmanifest in order to remove all citizen threads considering an GetObject request to the core.
{% endhint %}

## QBCore to vESX

```lua
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
AddEventHandler('QBCore:Client:OnPlayerLoaded',
    
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded',

RegisterNetEvent('QBCore:Client:OnJobUptade')
AddEventHandler('QBCore:Client:OnJobUptade', 

RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob',


QBCore.Functions.DrawText3D(1, 1, 1, 'Text')

DrawText3D(1, 1, 1, 'Text')


QBCore.UI.Menu.Open
QBCore.UI.Menu.CloseAll()

ESX.UI.Menu.Open
ESX.UI.Menu.CloseAll()

OR
Use OX_LIB


QBCore.Functions.Notify('Test', 'error')
ESX.ShowNotification('Test', 'error')


xPlayer.Functions.GetItemByName 
xPlayer.getInventoryItem

xPlayer.Functions.RemoveItem 
xPlayer.removeInventoryItem 

xPlayer.Functions.AddItem
xPlayer.addInventoryItem


QBCore.Functions.GetPlayer(src)

ESX.GetPlayerFromId(src)



QBCore.Functions.SpawnVehicle()
QBCore.Functions.GetVehicleProperties()
QBCore.Functions.GetClosestVehicle()


ESX.Game.SpawnVehicle()
ESX.Game.GetVehicleProperties()
ESX.Game.GetClosestVehicle()
ESX.Game.VehicleInDirection()





QBCore.Functions.GetPlayerData()

ESX.GetPlayerData()


QBCore.Functions.CreateUseableItem()

ESX.RegisterUsableItem()


QBCore.Functions.CreateCallback()

ESX.RegisterServerCallback()
QBCore.Functions.TriggerCallback()

ESX.TriggerServerCallback()



QBCore.Functions.CreateCallback('skillsystem:fetchStatus', function(source, cb)
    local Player = QBCore.Functions.GetPlayer(source)

     if Player then
           exports.oxmysql:execute('SELECT skills FROM players WHERE citizenid = @citizenid', {
               ['@citizenid'] = Player.PlayerData.citizenid
          }, function(status)
              if status ~= nil then
                   cb(json.decode(status))
              else
                   cb(nil)
              end
          end)
     else
          cb()
     end
end)

ESX.RegisterServerCallback("gamz-skillsystem:fetchStatus", function(source, cb)
    local src = source
    local user = ESX.GetPlayerFromId(src)


    local fetch = [[
         SELECT
              skills
         FROM
              users
         WHERE
              identifier = @identifier
    ]]

    exports.oxmysql:execute(fetch, {
         ["@identifier"] = user.identifier -- This returns the user's rockstar license

    }, function(status)

         if status ~= nil then
              cb(json.decode(status))
         else
              cb(nil)
         end

    end)
end)


QBCore.Functions.ExecuteSql()

MySQL.Async.execute()
-- MySQL ORR:
exports.oxmysql:execute()


QBCore.Commands.Add()

RegisterCommand()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://high-development.gitbook.io/vesx-framework/converting-scripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
