Change notifications
Most of our scripts have the same structure with notifications. In the configuration file you will find the following function:
function notifications(notitype, message, time)
-- Change this trigger for your notification system keeping the variables
end
-- Notifications types:
Noti.info = 'info'
Noti.check = 'check'
Noti.error = 'error'
-- Notification time:
Noti.time = 5000
Here are some sample notification scripts for you to adapt the script to your needs. If the notification script is not among these you will have to check the documentation of its developer and adapt it.
QB
function notifications(notitype, message, time)
QBCore.Functions.Notify(message, notitype, time)
end
-- Notifications types:
Noti.info = 'primary'
Noti.check = 'success'
Noti.error = 'error'
-- Notification time:
Noti.time = 5000
ESX
function notifications(notitype, message, time)
TriggerEvent('esx:showNotification', message, notitype, time)
end
-- Notifications types:
Noti.info = 'info'
Noti.check = 'success'
Noti.error = 'error'
-- Notification time:
Noti.time = 5000
BIT-Notifications
function notifications(title, message, time, type)
TriggerEvent("bit-notifications:open", 'Alert', message, time, type)
end
-- Notifications types:
Noti.info = 'info'
Noti.check = 'success'
Noti.error = 'error'
-- Notification time:
Noti.time = 5000
CODEM-Notification
function notifications(notitype, message, time)
TriggerEvent('codem-notification', message, time, notitype)
end
-- Notifications types:
Noti.info = 'info'
Noti.check = 'check'
Noti.error = 'error'
-- Notification time:
Noti.time = 5000
OKOKNotify
function notifications(title, text, time, type)
exports['okokNotify']:Alert('Alert', text, time, type)
end
--Notifications types:
Noti.info = 'info'
Noti.check = 'success'
Noti.error = 'error'
--Notification time:
Noti.time = 5000
ORIGEN Notify
function notifications(notitype, message, time)
exports["origen_notify"]:ShowNotification(message)
end
Noti.info = 'info'
Noti.check = 'check'
Noti.error = 'error'
Noti.time = 5000
OX lib
function notifications(notitype, message, time)
lib.notify({
title = 'Alert',
description = message,
type = notitype
})
end
-- Notifications types:
Noti.info = "inform"
Noti.check = "success"
Noti.error = "error"
Last updated