Snippets

EXPORT FOR ESX/QBCORE NOTIFICATIONS

ESX (es_extended/client/functions.lua)

Replace:

function ESX.ShowNotification(message, type, length)
    if GetResourceState("esx_notify") ~= "missing" then
        return exports["esx_notify"]:Notify(type, length, message)
    end

    print("[^1ERROR^7] ^5ESX Notify^7 is Missing!")
end

To:

function ESX.ShowNotification(message, type, length)
    if GetResourceState("mv-notify") ~= "missing" then
        return exports["mv-notify"]:sendNotification(type, length, message)
    end

    print("[^1ERROR^7] ^5MV Notify^7 is Missing!")
end

QBCORE (qb-core/client/functions.lua)

Replace:

function QBCore.Functions.Notify(text, texttype, length, icon)
    local message = {
        action = 'notify',
        type = texttype or 'primary',
        length = length or 5000,
    }

    if type(text) == 'table' then
        message.text = text.text or 'Placeholder'
        message.caption = text.caption or 'Placeholder'
    else
        message.text = text
    end

    if icon then
        message.icon = icon
    end

    SendNUIMessage(message)
end

To:

function QBCore.Functions.Notify(text, texttype, length, position)
  exports['mv-notify']:sendNotification(text, texttype, length, position or "top-right")
end

Last updated