QBCore
CreateThread(function()
if LoadFrameworkConfig() ~= 'QBCore' then return end
local QBCore = nil
if GetResourceState('qb-core') ~= "missing" then
QBCore = exports['qb-core']:GetCoreObject()
else
print('qb-core ressource not found the reset of frameworkConfig files is launch')
local fileName = "frameworkConfig"
local configData = { framework = "None" }
SaveJson(fileName, configData)
return
end
-- GET GetPlayers
function GetPlayer()
local players = QBCore.Functions.GetPlayers()
return players
end
-- GET CITIZENID
function GetCitizenId(player)
local playerData = QBCore.Functions.GetPlayer(player).PlayerData
-- print(playerData.citizenid)
return playerData.citizenid
end
-- GET PERMISSION
function GetPlayerPermission(player)
local playerPermission = QBCore.Functions.GetPermission(player)
-- print(json.encode(playerPermission))
return playerPermission
end
-- RemovePlayerItem
function RemovePlayerItem(playerId, itemName, quantity)
local player = QBCore.Functions.GetPlayer(playerId)
if player then
local removed = player.Functions.RemoveItem(itemName, quantity)
if removed then
return true
else
return false
end
end
return false
end
-- HasPlayerItem
function HasPlayerItem(playerId, itemName, quantity)
local player = QBCore.Functions.GetPlayer(playerId)
if player then
local item = player.Functions.GetItemByName(itemName)
if item and item.amount >= (quantity or 1) then
return true
end
end
return false
end
-- CreateUsableItem
function CreateUsableItem(itemName, propData)
QBCore.Functions.CreateUseableItem(itemName, function(source)
local playerId = source
TriggerClientEvent('peace-propsmanager:client:usePropItem', playerId, propData)
end)
end
end)
Last updated