❤️Frameworks


ATENTION!


QB-Core

  1. Locate the file: qb-core/client/functions.lua

  2. Replace the QBCore.Functions.Notify function with:

function QBCore.Functions.Notify(text, texttype, length)
    local convert = {
        ["primary"] = 'info',
        ["police"] = 'lspd',
        ["ambulance"] = 'ems'
    }
    
    texttype = texttype or 'info'
    texttype = convert[texttype] or texttype

    if type(text) == "table" then
        TriggerEvent('mg-notify:notify', 
            text.text or 'Placeholder', 
            texttype, 
            text.caption or 'Placeholder', 
            length or 5000
        )
    else
        TriggerEvent('mg-notify:notify', text, texttype, nil, length or 5000)
    end
end

Key Features

🔹 Backwards Compatibility - Existing scripts using QBCore.Functions.Notify work unchanged


ESX

  1. Locate the file: qb-core/client/functions.lua

  2. Replace the QBCore.Functions.Notify function with:

function ESX.ShowNotification(text, type, duration, title)
  local themeMap = {
        ['primary'] = 'info',
        ['police'] = 'lspd',
        ['ambulance'] = 'ems'
    }
    
    type = type or 'info'
    local notifyType = themeMap[type] or type
    local notifyDuration = duration or 5000

    TriggerEvent('mg-notify:notify', text, notifyType, title, notifyDuration)
    end
end

Key Features

🔹Backwards Compatibility - Existing scripts using ESX.ShowNotification() work unchanged


Last updated