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):

lua
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:Notify(data) end

For the text UI, in ox_lib/resource/interface/client/textui.lua, add one line at the top of each function:

lua
-- 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() end

QBCore

In qb-core/client/functions.lua, add this as the first line inside function QBCore.Functions.Notify(text, texttype, length, icon):

lua
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:Notify(text, texttype, length) end

ESX

In es_extended/client/functions.lua, add this as the first line inside function ESX.ShowNotification(...):

lua
if GetResourceState('mayo_notify') == 'started' then return exports.mayo_notify:Notify({ message = message, type = notifyType, duration = length, title = title, position = position }) end

Match the variable names to the arguments of the function in your ESX version.

Note

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

  1. Stop and remove the old resource.
  2. In mayo_notify/fxmanifest.lua, uncomment its provide line at the bottom:

    lua
    -- provide 'esx_notify'
    provide 'okokNotify'
    -- provide 'mythic_notify'
  3. Restart the server.

Scripts that call the old resource's exports and events now show Mayo Notify. What's covered:

ResourceExportsEvents
okokNotifyAlertokokNotify:Alert
t-notifyAlert, Custom
mythic_notifyDoHudText, DoShortHudText, DoLongHudText, DoCustomHudText, SendAlert, PersistentHudTextmythic_notify:client:SendAlert
pNotifySendNotificationpNotify:SendNotification
esx_notifyNotifyESX:Notify

These are in client/compat.lua, which is open to edit if one of your scripts calls something else.