Swap in framework
Here are the modified functions to your framework to make notifications and textui automatically adjust as vms_notifyV2.
ESX
Notification
Navigate to
es_extended/client/functions.lua
Find function
ESX.ShowNotification
Replace the function with the one below
function ESX.ShowNotification(message, notifyType, length)
local type = "info" -- Default preset if there is no notifyType
if notifyType == "success" then
type = "success" -- Default preset for "success" type notification
elseif notifyType == "error" then
type = "error" -- Default preset for "error" type notification
end
if length ~= nil and not tonumber(length) then
length = 5000 -- If the time is not given correctly or if it is not as a number
end
return exports['vms_notifyv2']:Notification({
description = message,
time = length,
preset = type
})
end
Find function
ESX.ShowAdvancedNotification
Replace the function with the one below
function ESX.ShowAdvancedNotification(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex)
if subject and subject ~= "" then
exports['vms_notifyv2']:Notification({
title = sender,
description = subject .. '~n~' .. msg,
time = 6500,
preset = 'info'
})
else
exports['vms_notifyv2']:Notification({
title = sender,
description = msg,
time = 6500,
preset = 'info'
})
end
end
TextUI
Navigate to
es_extended/client/functions.lua
Find function
ESX.TextUI
andESX.HideUI
Replace the function with the one below
function ESX.TextUI(message)
exports['vms_notifyv2']:ShowTextUI(message)
end
function ESX.HideUI()
exports['vms_notifyv2']:HideTextUI(message)
end
QB-Core
Notification
Navigate to
qb-core/client/functions.lua
Find function
QBCore.Functions.Notify
Replace the function with the one below
function QBCore.Functions.Notify(text, texttype, length, icon)
local message = {
action = 'notify',
type = texttype or 'info',
length = length or 5000,
}
if type(text) == 'table' then
message.text = text.text
message.caption = text.caption
else
message.text = text
end
local description = ""
if message.caption then
description = message.text .. '~s~' .. message.caption
else
description = message.text
end
if message.type == "primary" then
message.type = "info"
end
if icon then
message.icon = icon
end
exports['vms_notifyv2']:Notification({
description = description,
time = length,
icon = message.icon,
preset = message.type
})
end
TextUI
Navigate to
qb-core/client/drawtext.lua
Replace the entire file with the following code
local function hideText()
exports['vms_notifyv2']:HideTextUI()
end
local function drawText(text, position)
exports['vms_notifyv2']:ShowTextUI(text)
end
local function changeText(text, position)
exports['vms_notifyv2']:UpdateTextUI(text)
end
local function keyPressed()
exports['vms_notifyv2']:HideTextUI()
end
RegisterNetEvent('qb-core:client:DrawText', function(text, position)
drawText(text)
end)
RegisterNetEvent('qb-core:client:ChangeText', function(text, position)
changeText(text)
end)
RegisterNetEvent('qb-core:client:HideText', function()
hideText()
end)
RegisterNetEvent('qb-core:client:KeyPressed', function()
keyPressed()
end)
exports('DrawText', drawText)
exports('ChangeText', changeText)
exports('HideText', hideText)
exports('KeyPressed', keyPressed)
QBOX-Core
Notification
Navigate to
qbx_core/client/functions.lua
Find function
Notify
Replace the function with the one below
function Notify(text, notifyType, duration, subTitle, notifyPosition, notifyStyle, notifyIcon, notifyIconColor)
local title, description
if type(text) == 'table' then
title = text.text
description = text.caption or nil
elseif subTitle then
title = text
description = subTitle
else
description = text
end
if not notifyType or notifyType and notifyType == "primary" then
notifyType = "info"
end
exports['vms_notifyv2']:Notification({
title = title,
description = description,
time = duration,
icon = notifyIcon,
preset = notifyType
})
end
TextUI
Navigate to
qbx_core/bridge/qb/client/drawtext.lua
Replace the entire file with the following code
local function hideText()
exports['vms_notifyv2']:HideTextUI()
end
local function drawText(text, position)
exports['vms_notifyv2']:ShowTextUI(text)
end
local function changeText(text, position)
exports['vms_notifyv2']:UpdateTextUI(text)
end
local function keyPressed()
exports['vms_notifyv2']:HideTextUI()
end
RegisterNetEvent('qb-core:client:DrawText', function(text, position)
drawText(text)
end)
RegisterNetEvent('qb-core:client:ChangeText', function(text, position)
changeText(text)
end)
RegisterNetEvent('qb-core:client:HideText', function()
hideText()
end)
RegisterNetEvent('qb-core:client:KeyPressed', function()
keyPressed()
end)
local createQbExport = require 'bridge.qb.shared.export-function'
createQbExport('DrawText', drawText)
createQbExport('ChangeText', changeText)
createQbExport('HideText', hideText)
createQbExport('KeyPressed', keyPressed)
Last updated