esx.lua
if Config.Framework ~= 'esx' and (Config.Framework ~= 'auto' or GetResourceState('es_extended') ~= 'started' or GetResourceState('qb-core') == 'started') then return end
local ESX = exports['es_extended']:getSharedObject()
Bridge = {}
function Bridge.GetPlayerData()
return ESX.GetPlayerData()
end
function Bridge.GetPlayerJob()
local pd = ESX.GetPlayerData()
return pd.job and pd.job.name or "none"
end
function Bridge.TriggerCallback(name, cb, ...)
ESX.TriggerServerCallback(name, cb, ...)
end
function Bridge.HideText()
-- HideText fallback for ESX (usually controlled by other scripts like ox_lib or 3dme)
end
function Bridge.GetItems()
local pd = ESX.GetPlayerData()
return pd.inventory or {}
end
function Bridge.GetItemLabel(item)
return item:gsub("^%l", string.upper)
end
function Bridge.Notify(msg, type)
ESX.ShowNotification(msg)
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
-- Fallback to standard Mythic-Notify or similar if no ox_lib.
-- For ESX usually users use ox_lib nowadays.
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('esx_outlawalert:drugInProgress', coords)
end
end