This script is standalane. It works on every server!
How can i use the notify in my scripts?
Every script uses a notify function. So you have to change the notify event / export in all the scripts, which not use the mdev-notify or the default ESX / QB notify.
How does it work?
What is the source, title, message, time, type?
Source (You have to add the source in server side.)
Title (The title of the notify message)
Message (The message of the notify message)
Time (Time of visibility of the notify)
Type (info | success | warning | error)Server side
TriggerClientEvent('mdev-notify:SendNotify', source, 'title', 'message', time, 'type')
Client side
exports['mdev-notify']:SendNotify('title', 'message', time, 'type')
How to make our notify your framework default?
ESX
es_extended/client/functions.lua
Replace this function:
function ESX.ShowNotification(message, type, length)
exports['mdev-notify']:SendNotify('M Development', message, length, type)
end
QBCORE
qb-core/client/functions.lua
Replace this function:
function QBCore.Functions.Notify(text, texttype, length)
if type(text) == "table" then
local mdev-text = text.text or 'Placeholder'
local caption = text.caption or 'Placeholder'
texttype = texttype or 'primary'
length = length or 5000
exports['mdev-notify']:SendNotify(caption, mdev-text, length, texttype)
else
texttype = texttype or 'primary'
length = length or 5000
exports['mdev-notify']:SendNotify('M Development', text, length, texttype)
end
end