qbcore
Last updated
qb-core/client/functions.lua
Last updated
function QBCore.Functions.Notify(text, texttype, length, icon)
local typeMap = {
primary = 'info',
error = 'error',
success = 'success',
warning = 'warning',
info = 'info',
}
local message, title
if type(text) == 'table' then
message = text.text or 'Placeholder'
title = text.caption or nil
else
message = text
end
local success = pcall(function()
exports['nm1-classynotify']:Notify({
type = typeMap[texttype] or 'info',
message = message,
title = title,
duration = length or 5000,
icon = icon or nil,
position = 'top-right'
})
end)
if not success then
print('^1[nm1-classynotify]^7 Failed to send notification. Is the resource started?')
end
end