Notifications

Adding the notification system to your framework.

QBCore Implementation

function QBCore.Functions.Notify(text, textype, length)
    if type(text) == "table" then
        local ttext = text.text or 'Placeholder'
        local caption = text.caption or 'Placeholder'
        local icon = text.icon or 'fas fa-inbox'
        local length = length or 3000
        exports['ZSX_UI']:AddNotify(icon, caption, ttext, length)
    else
        local ttext = text or 'Placeholder'
        local length = length or 5000
        exports['ZSX_UI']:AddNotify('fas fa-inbox', 'Notification', ttext, length)
    end
end

ESX Implementation

function ESX.ShowNotification(message, type, length)
    if Config.NativeNotify then
        BeginTextCommandThefeedPost('STRING')
        AddTextComponentSubstringPlayerName(message)
        EndTextCommandThefeedPostTicker(0, 1)
    else
        exports['ZSX_UI']:AddNotify('fas fa-inbox', 'Notification', message, length)
    end
end

Usage

exports['ZSX_UI']:AddNotify('fas fa-inbox', 'Notification', 'This is my test notification.', 5000)
TriggerEvent('ZSX_UI:addNotify', 'fas fa-inbox', 'Notification', 'This is my test notification.', 5000)

Structure

Export

exports['ZSX_UI']:AddNotify(icon, header, text, time)

Event

TriggerEvent('ZSX_UI:addNotify', icon, header, text, time)

Last updated