DRS Notify
Notificações modernas e texto de ajuda [E] para todos os scripts do servidor, com a mesma aparência em todo o lado:
- 9 tipos: sucesso, erro, atenção, informação, polícia, INEM, mecânico, dinheiro e staff;
- 8 posições (a meia altura à direita por defeito), estilo cartão ou compacto;
- barra de tempo, sons do GTA, mensagens repetidas juntas (×2);
- notificações fixas que se atualizam pelo id;
- negrito, cores do GTA (
~r~,~g~…) e ícones do Font Awesome.
Funciona com Qbox, QBCore, ESX, ox_lib ou sem framework.
#Requisitos
Nada obrigatório.
#Instalação
- Coloca
drs_notifyemresources. - Adiciona
ensure drs_notifyaoserver.cfg. - Escolhe a posição, o estilo e as cores em
config.luae testa com/notifytest.
#Usar em todos os scripts
QBCore — em qb-core/client/functions.lua, no início de QBCore.Functions.Notify:
qb-core/client/functions.lua
function QBCore.Functions.Notify(text, texttype, length, icon)
if GetResourceState('drs_notify') == 'started' then return exports.drs_notify:Notify(text, texttype, length, icon) end
-- (o resto fica igual)ESX — em es_extended/client/functions.lua, no início de ESX.ShowNotification:
es_extended/client/functions.lua
if GetResourceState('drs_notify') == 'started' then return exports.drs_notify:Notify(message, notifyType, length) endQbox / ox_lib — em ox_lib/resource/interface/client/notify.lua, no início de lib.notify:
ox_lib/resource/interface/client/notify.lua
if GetResourceState('drs_notify') == 'started' then return exports.drs_notify:Notify(data) end#Para programadores
cliente
exports.drs_notify:Notify('Veículo guardado.', 'success')
exports.drs_notify:Notify({ title = 'Banco', description = 'Transferência de **500 $** feita', type = 'money', duration = 7000 })
-- fixa e atualizada pelo id
exports.drs_notify:Notify({ id = 'upload', description = 'A enviar… 10%', duration = 0 })
exports.drs_notify:Notify({ id = 'upload', description = 'A enviar… 80%', duration = 0 })
exports.drs_notify:Remove('upload')
-- texto de ajuda [E]
exports.drs_notify:ShowTextUI('Abrir garagem', 'E')
exports.drs_notify:ShowTextUI('Pegar na maca', { key = 'G', icon = 'fa-solid fa-bed', position = 'bottom-center' })
exports.drs_notify:HideTextUI()servidor
exports.drs_notify:Notify(source, 'Recebeste o salário.', 'money') -- -1 = todos
TriggerClientEvent('drs_notify:client:notify', source, { title = 'Polícia', description = 'Chamada 10-31', type = 'police' })Nomes que outros scripts usam (primary, inform, danger, warn…) são convertidos por Config.Aliases.
#Configuração completa
config.lua
-- DRS Notify — configuração / configuration
Config = {}
Config.Locale = 'pt' -- 'pt' | 'en'
-- Onde aparecem: 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center' | 'center-right' | 'center-left'
-- Where they show up
Config.Position = 'center-right'
Config.Style = 'card' -- 'card' (ícone, título e barra de tempo) | 'pill' (compacto / compact)
Config.Duration = 5000 -- ms
Config.MaxVisible = 5 -- por posição / per position
Config.Sound = true -- som do GTA ao aparecer / GTA sound when shown
Config.Scale = 1.0 -- tamanho geral / overall size (0.8 – 1.3)
Config.Font = 'Plus Jakarta Sans' -- qualquer letra do Google Fonts / any Google Fonts family
-- Texto de ajuda [E] (TextUI). Posição: 'center-left' | 'center-right' | 'bottom-center' | 'top-center'
Config.TextUI = { position = 'center-left', color = '#7c5cff' }
-- Tipos: cor, ícone (ver html/app.js ICONS), título por defeito (chave do locale) e som (nil = sem som).
-- Types: color, icon (see html/app.js ICONS), default title (locale key) and sound (nil = silent).
Config.Types = {
success = { color = '#34d399', icon = 'check', title = 'type_success', sound = { 'CHALLENGE_UNLOCKED', 'HUD_AWARDS' } },
error = { color = '#f87171', icon = 'x', title = 'type_error', sound = { 'ERROR', 'HUD_FRONTEND_DEFAULT_SOUNDSET' } },
warning = { color = '#fbbf24', icon = 'alert', title = 'type_warning', sound = { 'CHECKPOINT_MISSED', 'HUD_MINI_GAME_SOUNDSET' } },
info = { color = '#60a5fa', icon = 'info', title = 'type_info', sound = { 'NAV_UP_DOWN', 'HUD_FRONTEND_DEFAULT_SOUNDSET' } },
police = { color = '#3b82f6', icon = 'shield', title = 'type_police', sound = { 'Event_Message_Purple', 'GTAO_FM_Events_Soundset' } },
ambulance = { color = '#ef4444', icon = 'cross', title = 'type_ambulance', sound = { 'Event_Message_Purple', 'GTAO_FM_Events_Soundset' } },
mechanic = { color = '#f97316', icon = 'wrench', title = 'type_mechanic', sound = { 'NAV_UP_DOWN', 'HUD_FRONTEND_DEFAULT_SOUNDSET' } },
money = { color = '#22c55e', icon = 'cash', title = 'type_money', sound = { 'PURCHASE', 'HUD_LIQUOR_STORE_SOUNDSET' } },
staff = { color = '#a78bfa', icon = 'star', title = 'type_staff', sound = { 'Event_Message_Purple', 'GTAO_FM_Events_Soundset' } },
}
-- Nomes que outros scripts usam e para onde vão / names other scripts use and where they map
Config.Aliases = {
primary = 'info', inform = 'info', normal = 'info', default = 'info',
succes = 'success', ok = 'success', green = 'success',
danger = 'error', red = 'error', fail = 'error',
warn = 'warning', orange = 'warning', yellow = 'warning',
lspd = 'police', ems = 'ambulance', admin = 'staff',
}
-- Comando de demonstração (só no próprio cliente). false para desligar.
-- Demo command (client only). false to turn it off.
Config.TestCommand = 'notifytest'