Change Framework Notify
Use the steps below to replace your framework’s default notification handler with v42-notify.
Replace QBCore Notifications
Open
qb-core/client/functions.luaand find:
function QBCore.Functions.Notify(text, texttype, length)
if type(text) == "table" then
local ttext = text.text or 'Placeholder'
local caption = text.caption or 'Placeholder'
texttype = texttype or 'primary'
length = length or 5000
SendNUIMessage({
action = 'notify',
type = texttype,
length = length,
text = ttext,
caption = caption
})
else
texttype = texttype or 'primary'
length = length or 5000
SendNUIMessage({
action = 'notify',
type = texttype,
length = length,
text = text
})
end
endReplace with:
function QBCore.Functions.Notify(text, texttype, length)
exports['v42-notify']:notify(text, texttype, length)
endReplace ESX Notifications
Open
es_extended/client/functions.luaand find:
function ESX.ShowNotification(message, notifyType, length)
if GetResourceState("esx_notify") ~= "missing" then
return exports["esx_notify"]:Notify(notifyType, length, message)
end
print("[^1ERROR^7] ^5ESX Notify^7 is Missing!")
endReplace with:
function ESX.ShowNotification(message, notifyType, length)
if GetResourceState("v42-notify") ~= "missing" then
return exports['v42-notify']:notify(message, notifyType, length);
end
print("[^1ERROR^7] ^5v42-notify^7 is Missing!")
endEnable ESX Integration
Config.EsxNotification = trueReplace ox_lib Notifications
Open
ox_lib\resource\interface\client\notify.luaand find:
function lib.notify(data)
local sound = settings.notification_audio and data.sound
data.sound = nil
SendNUIMessage({
action = 'notify',
data = data
})
if not sound then return end
if sound.bank then lib.requestAudioBank(sound.bank) end
local soundId = GetSoundId()
PlaySoundFrontend(soundId, sound.name, sound.set, true)
ReleaseSoundId(soundId)
if sound.bank then ReleaseNamedScriptAudioBank(sound.bank) end
endReplace with:
function lib.notify(data)
local text = data.description or data.text or "Notification"
local textType = data.type or "info"
local time = data.duration or 5000
local caption = data.title or data.caption
if caption then
exports['v42-notify']:notify({ text = text, caption = caption }, textType, time)
else
exports['v42-notify']:notify(text, textType, time)
end
endLast updated
