🎯QBCore
Tested on
qb-core
resource version1.3.0
. If it doesn't work on a higher version, please report it on Discord.
ONEX NOTIFICATION
Follow these steps to replace the default QBCore notifications with ONEX Notification.
MODIFY CLIENT NOTIFICATION FUNCTION
-
Navigate to the Core Folder:
- Go to your
qb-core
folder. - Open the file:
qb-core/client/functions.lua
- Go to your
-
Locate the Notification Function:
- Around line 171, find the function
QBCore.Functions.Notify
.
- Around line 171, find the function
-
Replace the Function:
This is original Function
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
Replace the current function with the code below:
qb-core/client/function.lua
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
TriggerEvent('onex-interaction:client:notify', message.icon or false, message.caption or false, 1, message.text, message.type == 'primary' and '#00FF85' or '#ff0039', message.length)
end
MODIFY SERVER NOTIFICATION FUNCTION
-
Navigate to the Core Folder:
- Go to your
qb-core
folder. - Open the file:
qb-core/server/functions.lua
- Go to your
-
Locate the Notification Function:
- Around line 708, find the function
QBCore.Functions.Notify
.
- Around line 708, find the function
-
Replace the Function:
- Replace the current function with the code below:
qb-core/server/function.luafunction QBCore.Functions.Notify(source, text, type, length) TriggerClientEvent('onex-interaction:client:notify', source, false, false, 1, text, type == 'primary' and '#00FF85' or '#ff0039', length) end