Hello I have created a better function for QB-Core that uses error, warning and success instead of the numbers as the texttype
Here is the Code
function QBCore.Functions.Notify(text, texttype, length)
local texttype_map = {
["success"] = 1,
["error"] = 2,
["warning"] = 3,
}
if type(texttype) == "string" then
texttype = texttype_map[texttype:lower()] or 1 -- default to "normal" if the key is not found
end
if type(text) == "table" then
local ttext = text.text or 'Placeholder'
local caption = text.caption or 'Placeholder'
texttype = texttype or 1 -- default to "normal" if texttype is nil
length = length or 5000
exports['notifications']:sendnotify(ttext, texttype, length, caption)
else
texttype = texttype or 1 -- default to "normal" if texttype is nil
length = length or 5000
exports['notifications']:sendnotify(text, texttype, length)
end
end
This will allow you to use the notifications while maintaining qb-cores default syntax for notifications.
Thanks for the great script!
Hello I have created a better function for QB-Core that uses error, warning and success instead of the numbers as the texttype
Here is the Code
This will allow you to use the notifications while maintaining qb-cores default syntax for notifications. Thanks for the great script!