Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix qbus function
Browse files Browse the repository at this point in the history
  • Loading branch information
yeganehha authored Aug 25, 2021
1 parent 0838749 commit 133ba35
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions QBusFunction.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
ESX = nil
QBCore = nil

Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('jeserfcore:GetObject', function(obj) ESX = obj end)
while QBCore == nil do
TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
Citizen.Wait(0)
end
end)

function getPlayerIdentifier(playerId)
local Player = ESX.Functions.GetPlayer(playerId)
local Player = QBCore.Functions.GetPlayer(playerId)
if Player and Player.PlayerData then
return Player.PlayerData.citizenid
else
Expand All @@ -19,7 +19,7 @@ function getPlayerIdentifier(playerId)
end

function GetRealPlayerName(playerId)
local Player = ESX.Functions.GetPlayer(playerId)
local Player = QBCore.Functions.GetPlayer(playerId)

if Player then
return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname
Expand All @@ -33,14 +33,14 @@ function GetOOCPlayerName(playerId)
end

function citizenWear()
--[[ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
--[[QBCore.TriggerServerCallback('QBCore_skin:getPlayerSkin', function(skin)
TriggerEvent('skinchanger:loadSkin', skin)
end)]]
TriggerServerEvent("jeserf-clothes:loadPlayerSkin")
end

function isPlayerPedMale()
local Player = ESX.Functions.GetPlayerData()
local Player = QBCore.Functions.GetPlayerData()

if Player then
return ( Player.charinfo.gender == 0 and true or false )
Expand All @@ -51,8 +51,8 @@ end

function getPlayerSkin()
skins = {}
local Player = ESX.Functions.GetPlayerData()
ESX.Functions.TriggerCallback('jeserf-multicharacter:server:getSkin', function(model, data)
local Player = QBCore.Functions.GetPlayerData()
QBCore.Functions.TriggerCallback('jeserf-multicharacter:server:getSkin', function(model, data)
data = json.decode(data)
table.insert(skins , { c = 8 , d = data['t-shirt'].item, t = data['t-shirt'].texture })
table.insert(skins , { c = 11 , d = data['torso2'].item, t = data['torso2'].texture })
Expand All @@ -71,7 +71,7 @@ end


function setPlayerMoney(playerId,amount,typeTransaction)
local xPlayer = ESX.Functions.GetPlayer(playerId)
local xPlayer = QBCore.Functions.GetPlayer(playerId)

if xPlayer then
if typeTransaction == 'add' then
Expand All @@ -86,7 +86,7 @@ function setPlayerMoney(playerId,amount,typeTransaction)
end

function addSalary(playerId,amount)
local xPlayer = ESX.Functions.GetPlayer(playerId)
local xPlayer = QBCore.Functions.GetPlayer(playerId)
if xPlayer then
xPlayer.Functions.AddMoney('bank', amount)
return true
Expand All @@ -96,7 +96,7 @@ function addSalary(playerId,amount)
end

function OpenPlayerInventory(player)
local xPlayer = ESX.Functions.GetPlayer(player)
local xPlayer = QBCore.Functions.GetPlayer(player)
if xPlayer then
local data = {}
if xPlayer.PlayerData.money['cash'] > 0 then
Expand Down Expand Up @@ -137,7 +137,7 @@ function OpenPlayerInventory(player)
end

function PlayerInventoryGetItem(player, itemType, itemName, amount)
local XPlayer = ESX.Functions.GetPlayer(player)
local XPlayer = QBCore.Functions.GetPlayer(player)
if XPlayer then
if itemType == 'item' then
return XPlayer.Functions.RemoveItem(itemName, amount)
Expand All @@ -153,7 +153,7 @@ function PlayerInventoryGetItem(player, itemType, itemName, amount)
end

function PlayerInventoryGiveItem(player, itemType, itemName, amount)
local XPlayer = ESX.Functions.GetPlayer(player)
local XPlayer = QBCore.Functions.GetPlayer(player)
if XPlayer then
if itemType == 'item' then
return XPlayer.Functions.AddItem(itemName, amount)
Expand All @@ -169,7 +169,7 @@ function PlayerInventoryGiveItem(player, itemType, itemName, amount)
end

function isOwnedvehicle(source , vehicleProps)
local pData = ESX.Functions.GetPlayer(source)
local pData = QBCore.Functions.GetPlayer(source)
local result = exports['ghmattimysql']:executeSync( "SELECT * FROM `player_vehicles` WHERE citizenid = @citizenid AND `plate` = @plate ", {['@citizenid'] = pData.PlayerData.citizenid , ['plate'] = vehicleProps.plate }, function(result) end)
if result[1] ~= nil then
return true
Expand All @@ -178,7 +178,7 @@ function isOwnedvehicle(source , vehicleProps)
end

function deleteOwnedvehicle(source , vehicleProps)
local pData = ESX.Functions.GetPlayer(source)
local pData = QBCore.Functions.GetPlayer(source)
exports['ghmattimysql']:execute( "DELETE FROM `player_vehicles` WHERE citizenid = @citizenid AND `plate` = @plate ", {['@citizenid'] = pData.PlayerData.citizenid , ['plate'] = vehicleProps.plate }, function(result) end)
return true
end
Expand All @@ -194,4 +194,4 @@ end

function executeOnDB(query , params , cb)
exports['ghmattimysql']:execute(query, params , function(e) cb(e) end)
end
end

0 comments on commit 133ba35

Please sign in to comment.