mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 03:01:42 +00:00
edd9677f43
* ADD - build in-game admin command center * ADD - open admin panel by command * ENH - rebuild admin panel as standalone editor * ENH - compact admin workspace navigation * ENH - expand admin device controls * ENH - refine admin panel navigation style * ADD - add SQL phone configurator * FIX - expose complete phone configuration * FIX - make company jobs freely configurable * FIX - align configurator tables to left * ENH - organize configurator collection controls * ENH - organize nested configurator sections * ENH - add configurator field descriptions * FIX - hide fixed configurator add controls * ENH - refine configurator editing experience * ENH - refine admin configurator controls * FIX - apply configurator settings instantly * FIX - close live activity command registration
73 lines
2.0 KiB
Lua
73 lines
2.0 KiB
Lua
local framework_name
|
|
local esx
|
|
local qb
|
|
|
|
local function resolve_framework()
|
|
local configured = Config.Bridge.Framework
|
|
if configured ~= "auto" then
|
|
return configured
|
|
end
|
|
|
|
if GetResourceState("es_extended") == "started" then
|
|
return "esx"
|
|
end
|
|
if GetResourceState("qbx_core") == "started" then
|
|
return "qbox"
|
|
end
|
|
if GetResourceState("qb-core") == "started" then
|
|
return "qb"
|
|
end
|
|
|
|
return nil
|
|
end
|
|
|
|
local function refresh_framework()
|
|
local resolved = resolve_framework()
|
|
if resolved ~= "esx" and resolved ~= "qbox" and resolved ~= "qb" then
|
|
error("[sky_phone] No supported framework is running. Configure Config.Bridge.Framework.")
|
|
end
|
|
if resolved == framework_name then
|
|
return
|
|
end
|
|
|
|
framework_name = resolved
|
|
esx = nil
|
|
qb = nil
|
|
end
|
|
|
|
refresh_framework()
|
|
|
|
AddEventHandler("sky_phone:configurator:updated", refresh_framework)
|
|
|
|
function Bridge.Framework.GetName()
|
|
return framework_name
|
|
end
|
|
|
|
function Bridge.Framework.Notify(title, message, notification_type, duration)
|
|
if framework_name == "esx" then
|
|
esx = esx or exports["es_extended"]:getSharedObject()
|
|
esx.ShowNotification(message, notification_type, duration, title)
|
|
return
|
|
end
|
|
|
|
if framework_name == "qbox" then
|
|
exports.qbx_core:Notify(message, notification_type, duration, title)
|
|
return
|
|
end
|
|
|
|
if framework_name == "qb" then
|
|
qb = qb or exports["qb-core"]:GetCoreObject()
|
|
qb.Functions.Notify(message, notification_type, duration)
|
|
return
|
|
end
|
|
|
|
Bridge.Debug("error", "[sky_phone] Notification requested for unsupported framework '%s'.", tostring(framework_name))
|
|
end
|
|
|
|
function Bridge.Framework.ShowHelpNotification(message, key)
|
|
local control = key == "E" and "~INPUT_CONTEXT~" or ("[%s]"):format(tostring(key or "E"))
|
|
BeginTextCommandDisplayHelp("STRING")
|
|
AddTextComponentSubstringPlayerName(("%s %s"):format(control, tostring(message or "")))
|
|
EndTextCommandDisplayHelp(0, false, false, -1)
|
|
end
|