Refactor Dispatch.SendAlert for clarity
Assigns alert data to a local variable before passing it to exports.tk_dispatch:addCall, improving readability and maintainability.
This commit is contained in:
1 parent
664b397404
commit
3a9424659b
1 file changed
+3
-2
@@ -3,7 +3,7 @@ if GetResourceState('tk_dispatch') == 'missing' then return end
|
|||||||
Dispatch = Dispatch or {}
|
Dispatch = Dispatch or {}
|
||||||
|
|
||||||
Dispatch.SendAlert = function(data)
|
Dispatch.SendAlert = function(data)
|
||||||
exports.tk_dispatch:addCall({
|
local alertData = {
|
||||||
title = data.message,
|
title = data.message,
|
||||||
code = data.code or '10-80',
|
code = data.code or '10-80',
|
||||||
priority = 'Priority 3',
|
priority = 'Priority 3',
|
||||||
@@ -17,7 +17,8 @@ Dispatch.SendAlert = function(data)
|
|||||||
scale = data.blipData.scale or 0.8,
|
scale = data.blipData.scale or 0.8,
|
||||||
},
|
},
|
||||||
jobs = data.jobs or {'police'},
|
jobs = data.jobs or {'police'},
|
||||||
})
|
}
|
||||||
|
exports.tk_dispatch:addCall(alertData)
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the in use resource.
|
---This will get the name of the in use resource.
|
||||||
|
|||||||
Reference in new issue
Block a user