forked from Simnation/Main
56 lines
No EOL
2 KiB
Lua
56 lines
No EOL
2 KiB
Lua
local frameworkSystem = (function()
|
|
if GetResourceState('qb-core') == 'started' then return 'qb' end
|
|
if GetResourceState('qbx_core') == 'started' then return 'qbx' end
|
|
if GetResourceState('es_extended') == 'started' then return 'esx' end
|
|
|
|
return 'custom'
|
|
end)()
|
|
|
|
Framework = frameworkSystem
|
|
CORE = nil
|
|
|
|
local function loadFramework()
|
|
if Framework == 'qb' or Framework == 'qbx' then
|
|
CORE = exports['qb-core']:GetCoreObject()
|
|
elseif Framework == 'esx' then
|
|
CORE = exports.es_extended:getSharedObject()
|
|
|
|
if not CORE then
|
|
CreateThread(function()
|
|
while not CORE do
|
|
TriggerEvent('esx:getSharedObject', function(obj) CORE = obj end)
|
|
Wait(0)
|
|
end
|
|
end)
|
|
end
|
|
elseif Framework == 'custom' then
|
|
warn('Add your own framework export system in bridge.lua at line 27')
|
|
end
|
|
end
|
|
|
|
loadFramework()
|
|
|
|
function Notification(msg, type, time)
|
|
if Framework == 'qb' or Framework == 'qbx' then
|
|
CORE.Functions.Notify(msg, type == 'info' and 'primary' or type, time)
|
|
elseif Framework == 'esx' then
|
|
CORE.ShowNotification(msg, type, time)
|
|
elseif Framework == 'custom' then
|
|
warn('Add your own notify export system in bridge.lua at line 39')
|
|
end
|
|
end
|
|
|
|
---@param data table {coords (vector3), size (vector3), debug (boolean), rotation (number), options (table {groups (table), onSelect (function), icon (string), label (string), job (table), gang (table), distance (number)}
|
|
function CustomTarget(data)
|
|
-- EXAMPLE :
|
|
-- exports.ox_target:addBoxZone({
|
|
-- coords = data.coords,
|
|
-- size = data.size,
|
|
-- debug = data.debug,
|
|
-- rotation = data.rotation,
|
|
-- options = data.options
|
|
-- })
|
|
warn('Add you own target system exports in bridge.lua at line 45')
|
|
end
|
|
|
|
RegisterNetEvent('patoche:interact:client:notification', Notification) |