58 lines
1.4 KiB
Lua
58 lines
1.4 KiB
Lua
if Config.qbSettings.enabled then
|
|
if Config.qbSettings.useNewQBExport then
|
|
QBCore = exports['qb-core']:GetCoreObject()
|
|
end
|
|
|
|
function HasItem(player, item)
|
|
local xPlayer = QBCore.Functions.GetPlayer(player)
|
|
|
|
return xPlayer.Functions.GetItemByName(item)
|
|
end
|
|
|
|
function IsPolice(player)
|
|
local xPlayer = QBCore.Functions.GetPlayer(player)
|
|
if not xPlayer then
|
|
return false
|
|
end
|
|
|
|
local job = xPlayer.PlayerData.job
|
|
|
|
return Contains(Config.policeJobNames, job.name)
|
|
end
|
|
|
|
function IsInGang(player)
|
|
local xPlayer = QBCore.Functions.GetPlayer(player)
|
|
if not xPlayer then
|
|
return false
|
|
end
|
|
|
|
local gang = xPlayer.PlayerData.gang
|
|
if not gang then
|
|
return false
|
|
end
|
|
|
|
return gang.name ~= nil and gang.name ~= 'none' and gang.name ~= ''
|
|
end
|
|
|
|
function GetPoliceCount()
|
|
local currentOfficers = 0
|
|
for _, playerId in ipairs(GetPlayers()) do
|
|
playerId = tonumber(playerId)
|
|
if IsPolice(playerId) then
|
|
currentOfficers = currentOfficers + 1
|
|
end
|
|
end
|
|
return currentOfficers
|
|
end
|
|
|
|
function AddMoney(player, amount)
|
|
local xPlayer = QBCore.Functions.GetPlayer(player)
|
|
|
|
if not xPlayer then
|
|
return false
|
|
end
|
|
|
|
xPlayer.Functions.AddMoney(Config.qbSettings.moneyAccount, amount)
|
|
end
|
|
end
|