function ESX.ShowNotification(message, type, length)
if (GetResourceState("rat-notify") == "missing") then
Citizen.Trace("^8ERROR ^7rat-notify is not present or started.")
return
end
local title = "Notify"
local style = "default"
if (type == "info" or type == "success" or type == "error") then
title = type:gsub("^%1", string.upper)
style = type
end
exports["rat-notify"]:Add({
title = title,
text = message,
style = style,
duration = length or 5000
})
end
function QBCore.Functions.Notify(text, texttype, length, icon)
if (GetResourceState("rat-notify") == "missing") then
Citizen.Trace("^8ERROR ^7rat-notify is not present or started.")
return
end
if (icon) then icon = (icon):gsub("fas", "fa-solid") end
local t = "info"
if (texttype) then t = texttype end
-- Capitalize the first letter of `texttype`
local title = t:gsub("^%l", string.upper)
exports["rat-notify"]:Add({
title = title,
text = text,
style = t,
duration = length or 5000
})
end
function lib.notify(data)
local position = data.position or settings.notification_position
if ( GetResourceState('rat-notity') == "missing" ) then
Citizen.Trace("^8ERROR ^7rat-notify is not present or started.")
return
end
exports["rat-notify"]:Add({
id = data.id,
title = data.title,
text = data.description,
duration = data.duration,
style = data.type,
icon = data.icon,
pos = position
})
end