Introduces a standardized GetResourceName function to banking, clothing, dispatch, doorlock, framework, fuel, helptext, housing, and other modules. This function returns the name of the in-use resource, improving resource identification and interoperability across the codebase.
39 lines
1.4 KiB
Lua
39 lines
1.4 KiB
Lua
---@diagnostic disable: duplicate-set-field
|
|
Dispatch = Dispatch or {}
|
|
|
|
---This will send an alert to currently supported dispatch systems.
|
|
---@param data table The data to send to the dispatch system.
|
|
---@return nil
|
|
Dispatch.SendAlert = function(data)
|
|
local ped = PlayerPedId()
|
|
TriggerServerEvent('community_bridge:Server:DispatchAlert', {
|
|
sprite = data.blipData.sprite or 161,
|
|
color = data.blipData.color or 1,
|
|
scale = data.blipData.scale or 0.8,
|
|
vehicle = data.vehicle or nil,
|
|
plate = data.vehicle and GetVehicleNumberPlateText(data.vehicle) or nil,
|
|
ped = data.ped or ped,
|
|
pedCoords = data.pedCoords or GetEntityCoords(ped),
|
|
coords = data.coords or GetEntityCoords(ped),
|
|
message = data.message or "An Alert Has Been Made",
|
|
code = data.code or '10-80',
|
|
icon = data.icon or 'fas fa-question',
|
|
jobs = data.jobs or {'police'},
|
|
time = data.time or 100000
|
|
})
|
|
end
|
|
|
|
RegisterNetEvent('community_bridge:Client:DispatchAlert', function(alert)
|
|
Notify.SendNotify(alert.message, "success", 15000)
|
|
local blip = Bridge.Utility.CreateBlip(alert.coords, alert.sprite, alert.color, alert.scale, alert.code, true)
|
|
Wait(alert.time)
|
|
Bridge.Utility.RemoveBlip(blip)
|
|
end)
|
|
|
|
---This will get the name of the in use resource.
|
|
---@return string
|
|
Dispatch.GetResourceName = function()
|
|
return 'default'
|
|
end
|
|
|
|
return Dispatch |