Replacing your notify
Show notifications from ox_lib, QBCore, ESX and other notify resources in Mayo Notify.
Most scripts send notifications through your framework or a notify resource. Point those at Mayo Notify and every script shows Mayo Notify, with no edits to the scripts themselves.
ox_lib (also covers Qbox)
In ox_lib/resource/interface/client/notify.lua, add this as the first line inside function lib.notify(data):
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:Notify(data) endFor the text UI, in ox_lib/resource/interface/client/textui.lua, add one line at the top of each function:
-- function lib.showTextUI(text, options)
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:ShowTextUI(text, options) end
-- function lib.hideTextUI()
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:HideTextUI() end
-- function lib.isTextUIOpen()
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:IsTextUIOpen() endQBCore
In qb-core/client/functions.lua, add this as the first line inside function QBCore.Functions.Notify(text, texttype, length, icon):
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:Notify(text, texttype, length) endESX
In es_extended/client/functions.lua, add this as the first line inside function ESX.ShowNotification(...):
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:Notify({ message = message, type = notifyType, duration = length, title = title, position = position }) endMatch the variable names to the arguments of the function in your ESX version.
Each patch checks that Mayo Notify is running first. If you stop it, your framework's own notifications come back.
okokNotify, mythic_notify, pNotify, t-notify and esx_notify
- Stop and remove the old resource.
In
mayo_notify/fxmanifest.lua, uncomment itsprovideline at the bottom:-- provide 'esx_notify' provide 'okokNotify' -- provide 'mythic_notify'- Restart the server.
Scripts that call the old resource's exports and events now show Mayo Notify. What's covered:
| Resource | Exports | Events |
|---|---|---|
| okokNotify | Alert | okokNotify:Alert |
| t-notify | Alert, Custom | |
| mythic_notify | DoHudText, DoShortHudText, DoLongHudText, DoCustomHudText, SendAlert, PersistentHudText | mythic_notify:client:SendAlert |
| pNotify | SendNotification | pNotify:SendNotification |
| esx_notify | Notify | ESX:Notify |
These are in client/compat.lua, which is open to edit if one of your scripts calls something else.