function Initialized() print("GAGO") if Config.Framework == 'ESX' then ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) QBCore = true RegisterUsableItem = ESX.RegisterUsableItem elseif Config.Framework == 'QBCORE' then QBCore = exports['qb-core']:GetCoreObject() ESX = true RegisterUsableItem = QBCore.Functions.CreateUseableItem else ESX = true QBCore = true end end function GetPlayerFromId(src) self = {} self.src = src if Config.Framework == 'ESX' then return ESX.GetPlayerFromId(self.src) elseif Config.Framework == 'QBCORE' then selfcore = {} selfcore.data = QBCore.Functions.GetPlayer(self.src) if selfcore.data.identifier == nil then selfcore.data.identifier = selfcore.data.PlayerData.license end if selfcore.data.citizenid == nil then selfcore.data.citizenid = selfcore.data.PlayerData.citizenid end if selfcore.data.job == nil then selfcore.data.job = selfcore.data.PlayerData.job end selfcore.data.getMoney = function(value) return selfcore.data.PlayerData.money['cash'] end selfcore.data.addMoney = function(value) QBCore.Functions.GetPlayer(tonumber(self.src)).Functions.AddMoney('cash',tonumber(value)) return true end selfcore.data.removeMoney = function(value) QBCore.Functions.GetPlayer(tonumber(self.src)).Functions.RemoveMoney('cash',tonumber(value)) return true end selfcore.data.getAccount = function(type) if type == 'money' then type = 'cash' end return {money = selfcore.data.PlayerData.money[type]} end selfcore.data.removeAccountMoney = function(type,val) if type == 'money' then type = 'cash' end QBCore.Functions.GetPlayer(tonumber(self.src)).Functions.RemoveMoney(type,tonumber(val)) return true end selfcore.data.showNotification = function(msg) TriggerEvent('QBCore:Notify',self.src, msg) return true end selfcore.data.removeInventoryItem = function(item,val) QBCore.Functions.GetPlayer(tonumber(self.src)).Functions.RemoveItem(item, val) end if selfcore.data.source == nil then selfcore.data.source = self.src end -- we only do wrapper or shortcuts for what we used here. -- a lot of qbcore functions and variables need to port , its possible to port all, but we only port what this script needs. return selfcore.data end end function SqlFunc(plugin,type,query,var) local wait = promise.new() if type == 'fetchAll' and plugin == 'mysql-async' then MySQL.Async.fetchAll(query, var, function(result) wait:resolve(result) end) end if type == 'execute' and plugin == 'mysql-async' then MySQL.Async.execute(query, var, function(result) wait:resolve(result) end) end if type == 'execute' and plugin == 'ghmattisql' then exports['ghmattimysql']:execute(query, var, function(result) wait:resolve(result) end) end if type == 'fetchAll' and plugin == 'ghmattisql' then exports.ghmattimysql:execute(query, var, function(result) wait:resolve(result) end) end if type == 'execute' and plugin == 'oxmysql' then exports.oxmysql:execute(query, var, function(result) wait:resolve(result) end) end if type == 'fetchAll' and plugin == 'oxmysql' then exports['oxmysql']:fetch(query, var, function(result) wait:resolve(result) end) end return Citizen.Await(wait) end