Skip to content

Instantly share code, notes, and snippets.

@itsP33t
Created March 18, 2023 22:53
Show Gist options
  • Save itsP33t/f86174c01d1f75ba17e8ea45acadc959 to your computer and use it in GitHub Desktop.
Save itsP33t/f86174c01d1f75ba17e8ea45acadc959 to your computer and use it in GitHub Desktop.
Notification function that supports a lot of notification providers. Feel free to add more if you know some
function Notify(title, text, length, type, src)
if IsDuplicityVersion() then
-- Running on server
if Config.Notify == "qb" then
-- https://docs.qbcore.org/qbcore-documentation/qb-core/client-event-reference#qbcore-notify
TriggerClientEvent("QBCore:Notify", src, text, type, length)
elseif Config.Notify == "okok" then
-- https://docs.okokscripts.io/scripts/okoknotify
TriggerClientEvent('okokNotify:Alert', src, title, text, length, type)
elseif Config.Notify == "es.lib" then
-- https://github.com/ESFramework/es.lib
TriggerClientEvent("es.lib:showNotify", src, title, "noicon", text, length, type)
elseif Config.Notify == "brutal" then
-- https://docs.brutalscripts.com/site/scripts/brutal-notify
TriggerClientEvent('brutal_notify:SendAlert', src, title, text, length, type)
elseif Config.Notify == "b-dev" then
-- https://forum.cfx.re/t/paid-standalone-notify-the-best-notify-with-6-different-types/4905568
TriggerClientEvent("b-notify:notify", src, type, title, text)
end
else
-- Running on client
if Config.Notify == "qb" then
-- https://docs.qbcore.org/qbcore-documentation/qb-core/client-event-reference#qbcore-notify
TriggerEvent("QBCore:Notify", text, type, length)
elseif Config.Notify == "okok" then
-- https://docs.okokscripts.io/scripts/okoknotify
exports["okokNotify"]:Alert(title, text, length, type)
elseif Config.Notify == "es.lib" then
-- https://github.com/ESFramework/es.lib
TriggerEvent("es.lib:showNotify", title, "noicon", text, length, type)
elseif Config.Notify == "brutal" then
-- https://docs.brutalscripts.com/site/scripts/brutal-notify
exports["brutal_notify"]:SendAlert(title, text, length, type)
elseif Config.Notify == "b-dev" then
-- https://forum.cfx.re/t/paid-standalone-notify-the-best-notify-with-6-different-types/4905568
TriggerEvent("b-notify:notify", type, title, text)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment