ESX to QBCORE Conversion Thread - this is for chaining a ESX framework mod into QBCore aka Qbus framework.
ESX to QBCORE Object Reference
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(30)-- Saniye Bekletme
end
end)
' QBCORE - ESX REPLACEMENT '
QBCore = nil
local QBCore = exports['qb-core']:GetCoreObject()
Citizen.CreateThread(function()
while QBCore == nil do
TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
Citizen.Wait(30) -- Saniye Bekletme
end
end)
ESX Load player identifier
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded',
' QBCORE - ESX REPLACEMENT '
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
AddEventHandler('QBCore:Client:OnPlayerLoaded',
ESX Check JOB
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob',
' QBCORE - ESX REPLACEMENT '
RegisterNetEvent('QBCore:Client:OnJobUptade')
AddEventHandler('QBCore:Client:OnJobUptade',
ESX Player Death
RegisterNetEvent('esx:onPlayerDeath')
AddEventHandler('esx:onPlayerDeath',
' QBCORE - ESX REPLACEMENT '
RegisterNetEvent('QBCore:Client:OnPlayerUnload')
AddEventHandler('QBCore:Client:OnPlayerUnload',
ESX Get Closest Player
ESX.Game.GetClosestPlayer()
' QBCORE - ESX REPLACEMENT '
QBCore.Functions.GetClosestPlayer()
' ESX OPEN Close Menu '
DrawText3D(1, 1, 1, 'Sample')
ESX.Game.Utils.DrawText3D(1, 1, 1, 'Sample')
' QBCORE - ESX REPLACEMENT '
QBCore.UI.Menu.Open
QBCore.UI.Menu.CloseAll()
ESX Notification Display
TriggerEvent('Notification',"Text/Samle.")
ESX.ShowHelpNotification('Text/Samle.')
' QBCORE - ESX REPLACEMENT '
TriggerClientEvent("QBCore:Notify", "Text/Sample, "success", 2500)
QBCore.Functions.Notify("Text/Sample.", "error")
ESX Get Inventory Item
xPlayer.getInventoryItem
' QBCORE - ESX REPLACEMENT '
xPlayer.Functions.GetItemByName
ESX Get player name
xPlayer.getName()
' QBCORE - ESX REPLACEMENT '
xPlayer.PlayerData.name
ESX Set current job
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)```
' QBCORE - ESX REPLACEMENT '
```RegisterNetEvent('QBCore:Client:OnJobUpdate')
AddEventHandler('QBCore:Client:OnJobUpdate', function(job)
PlayerData.job = job
end)```
ESX add or remove money
```xPlayer.removeAccountMoney('bank', amount)
xPlayer.addMoney(amount)```
' QBCORE - ESX REPLACEMENT '
Player.Functions.AddMoney('bank', amount, "Bank depost")
Player.Functions.RemoveMoney('cash', amount, "Bank depost")
ESX Get bank Funds
`xPlayer.getAccount('bank').money `
' QBCORE - ESX REPLACEMENT '
Player.PlayerData.money["bank"]
ESX ADD/Remove Item
xPlayer.addInventoryItem
xPlayer.removeInventoryItem
' QBCORE - ESX REPLACEMENT '
```xPlayer.Functions.RemoveItem
xPlayer.Functions.AddItem```