qb.lua
if Config.Framework ~= 'qb' and Config.Framework ~= 'qbox' and (Config.Framework ~= 'auto' or GetResourceState('qb-core') ~= 'started') then return end
local QBCore = exports['qb-core']:GetCoreObject()
Bridge = {}
function Bridge.GetPlayerData()
return QBCore.Functions.GetPlayerData()
end
function Bridge.GetPlayerJob()
local pd = QBCore.Functions.GetPlayerData()
return pd.job and pd.job.name or "none"
end
function Bridge.TriggerCallback(name, cb, ...)
QBCore.Functions.TriggerCallback(name, cb, ...)
end
function Bridge.HideText()
exports['qb-core']:HideText()
end
function Bridge.GetItems()
local pd = QBCore.Functions.GetPlayerData()
return pd.items or {}
end
function Bridge.GetItemLabel(item)
return QBCore.Shared.Items[item] and QBCore.Shared.Items[item].label or item
end
function Bridge.Notify(msg, type)
QBCore.Functions.Notify(msg, type)
end
function Bridge.Progress(name, label, duration, useLib, anim, prop, disable, cb)
if useLib == 'ox' then
if exports.ox_lib:progressBar({
duration = duration,
label = label,
useWhileDead = false,
canCancel = true,
disable = disable,
anim = anim,
prop = prop,
}) then cb() end
else
QBCore.Functions.Progressbar(name, label, duration, false, true, disable, anim, prop, {}, function() -- Done
cb()
end, function() -- Cancel
end)
end
end
function Bridge.CallDispatch(coords)
local dispatch = Config.DispatchSystem
local msg = Config.Locales[Config.Lang]['dispatch_msg'] or 'UyuΕturucu SatΔ±ΕΔ± Δ°hbarΔ±'
if dispatch == 'ps-dispatch' then
if GetResourceState('ps-dispatch') == 'started' then
exports['ps-dispatch']:SuspiciousActivity()
end
elseif dispatch == 'qs-dispatch' then
if GetResourceState('qs-dispatch') == 'started' then
TriggerServerEvent('qs-dispatch:server:CreateDispatchCall', {
job = {'police', 'sheriff'},
callLocation = coords,
callCode = { code = '10-31', snippet = 'Drug Sale' },
message = msg,
flashes = false,
image = nil,
blip = {sprite = 51, color = 1, scale = 1.0, text = msg, time = 20000}
})
end
elseif dispatch == 'cd_dispatch' then
if GetResourceState('cd_dispatch') == 'started' then
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = {'police', 'sheriff'},
coords = coords,
title = '10-31 - Drug Sale',
message = msg,
flash = 0,
unique_id = tostring(math.random(0000000,9999999)),
sound = 1,
blip = {sprite = 51, colour = 1, scale = 1.0, text = msg, time = 20000, radius = 0}
})
end
elseif dispatch == 'core_dispatch' then
if GetResourceState('core_dispatch') == 'started' then
exports['core_dispatch']:addCall("10-31", msg, {
{icon = "fa-pills", info = "Drug Dealing"}
}, {Coords = coords}, 'police', 3000, 51, 1)
end
else
TriggerServerEvent('police:server:policeAlert', msg)
end
end