Installation
Discover how to install your script.
β’ STEP 1: DEPENDENCIES
Make sure you have this resources installed in your server!
this resource is standalone, it works with any framework.
β’ STEP 2: START ORDER
ensure zr-notify
β’ STEP 3: DATABASE
This script doesn't require any database installation.
β’ STEP 4: EXPORTS (Client Side)
-- eexports['zr-notify']:zr_notify('type', 'message', time, 'title', 'side')
exports['zr-notify']:zr_notify('bank', "Write here your messages.", 5000, 'BANK', 'left')
exports['zr-notify']:zr_notify('car', "Write here your messages.", 5000, 'CAR', 'left')
exports['zr-notify']:zr_notify('cash', "Write here your messages.", 5000, 'CASH', 'left')
exports['zr-notify']:zr_notify('error', "Write here your messages.", 5000, 'ERROR', 'left')
exports['zr-notify']:zr_notify('info', "Write here your messages.", 5000, 'INFO', 'left')
exports['zr-notify']:zr_notify('message', "Write here your messages.", 5000, 'MESSAGE', 'right')
exports['zr-notify']:zr_notify('phone', "Write here your messages.", 5000, 'PHONE', 'right')
exports['zr-notify']:zr_notify('primary', "Write here your messages.", 5000, 'PRIMARY', 'right')
exports['zr-notify']:zr_notify('success', "Write here your messages.", 5000, 'SUCCESS', 'right')
exports['zr-notify']:zr_notify('warning', "Write here your messages.", 5000, 'WARNING', 'right')
β’ STEP 5: TRIGGERS
From Client Side :
TriggerEvent('zr-notify:Notify', 'bank', "Write here your messages.", 5000, 'BANK', 'left')
TriggerEvent('zr-notify:Notify', 'car', "Write here your messages.", 5000, 'CAR', 'left')
TriggerEvent('zr-notify:Notify', 'cash', "Write here your messages.", 5000, 'CASH', 'left')
TriggerEvent('zr-notify:Notify', 'error', "Write here your messages.", 5000, 'ERROR', 'left')
TriggerEvent('zr-notify:Notify', 'info', "Write here your messages.", 5000, 'INFO', 'left')
TriggerEvent('zr-notify:Notify', 'message', "Write here your messages.", 5000, 'MESSAGE', 'right')
TriggerEvent('zr-notify:Notify', 'phone', "Write here your messages.", 5000, 'PHONE', 'right')
TriggerEvent('zr-notify:Notify', 'primary', "Write here your messages.", 5000, 'PRIMARY', 'right')
TriggerEvent('zr-notify:Notify', 'success', "Write here your messages.", 5000, 'SUCCESS', 'right')
TriggerEvent('zr-notify:Notify', 'warning', "Write here your messages.", 5000, 'WARNING', 'right')
From Server Side :
TriggerClientEvent('zr-notify:Notify', source, 'bank', "Write here your messages.", 5000, 'BANK', 'left')
TriggerClientEvent('zr-notify:Notify', source, 'car', "Write here your messages.", 5000, 'CAR', 'left')
TriggerClientEvent('zr-notify:Notify', source, 'cash', "Write here your messages.", 5000, 'CASH', 'left')
TriggerClientEvent('zr-notify:Notify', source, 'error', "Write here your messages.", 5000, 'ERROR', 'left')
TriggerClientEvent('zr-notify:Notify', source, 'info', "Write here your messages.", 5000, 'INFO', 'left')
TriggerClientEvent('zr-notify:Notify', source, 'message', "Write here your messages.", 5000, 'MESSAGE', 'right')
TriggerClientEvent('zr-notify:Notify', source, 'phone', "Write here your messages.", 5000, 'PHONE', 'right')
TriggerClientEvent('zr-notify:Notify', source, 'primary', "Write here your messages.", 5000, 'PRIMARY', 'right')
TriggerClientEvent('zr-notify:Notify', source, 'success', "Write here your messages.", 5000, 'SUCCESS', 'right')
TriggerClientEvent('zr-notify:Notify', source, 'warning', "Write here your messages.", 5000, 'WARNING', 'right')
β’ EXAMPLE : Paycheck QBCore
function PaycheckInterval()
local src = source
if next(QBCore.Players) then
for _, Player in pairs(QBCore.Players) do
if Player then
local payment = QBShared.Jobs[Player.PlayerData.job.name]['grades'][tostring(Player.PlayerData.job.grade.level)].payment
if not payment then payment = Player.PlayerData.job.payment end
if Player.PlayerData.job and payment > 0 and (QBShared.Jobs[Player.PlayerData.job.name].offDutyPay or Player.PlayerData.job.onduty) then
if QBCore.Config.Money.PayCheckSociety then
local account = exports['qb-management']:GetAccount(Player.PlayerData.job.name)
if account ~= 0 then -- Checks if player is employed by a society
if account < payment then -- Checks if company has enough money to pay society
-- TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
TriggerClientEvent('zr-notify:Notify', Player.PlayerData.source, 'error', "Your employer is broke", 5000, 'ERROR', 'left')
else
Player.Functions.AddMoney('bank', payment)
exports['qb-management']:RemoveMoney(Player.PlayerData.job.name, payment)
-- TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerClientEvent('zr-notify:Notify', Player.PlayerData.source, 'bank', "You received your paycheck of $"..payment, 5000, 'BANK', 'left')
end
else
Player.Functions.AddMoney('bank', payment)
-- TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerClientEvent('zr-notify:Notify', Player.PlayerData.source, 'bank', "You received your paycheck of $"..payment, 5000, 'BANK', 'left')
end
else
Player.Functions.AddMoney('bank', payment)
-- TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerClientEvent('zr-notify:Notify', Player.PlayerData.source, 'bank', "You received your paycheck of $"..payment, 5000, 'BANK', 'left')
end
end
end
end
end
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end
β’ STEP 6: EXTRA
If you have qbcore or esx, you can change all the server notifications from the core, so you avoid doing it manually for every single notification.
For qbcore framework.
qbcore -> client -> functions.lua
function QBCore.Functions.Notify(text, texttype, length)
if type(text) == "table" then
local text = text.text or 'Placeholder'
local caption = text.caption or 'Placeholder'
texttype = texttype or 'info'
length = length or 5000
exports['zr-notify']:zr_notify(texttype, text, length, texttype, 'left')
else
texttype = texttype or 'info'
length = length or 5000
exports['zr-notify']:zr_notify(texttype, text, length, texttype, 'left')
end
end
for esx framework.
es_extended -> client -> functions.lua
function ESX.ShowNotification(message, type, length)
if GetResourceState("esx_notify") ~= "missing" then
return exports['zr-notify']:zr_notify(type, message, length, type, 'left')
end
print("[^1ERROR^7] ^5ESX Notify^7 is Missing!")
end
Last updated