Skip to content

Commit

Permalink
feat(server/interface): configurable txAdmin notifications override (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
demxnn authored May 9, 2023
1 parent 361ce6c commit 8a8700c
Show file tree
Hide file tree
Showing 28 changed files with 201 additions and 30 deletions.
3 changes: 2 additions & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ files {
shared_script 'resource/init.lua'

shared_scripts {
'imports/locale/shared.lua',
'resource/**/shared.lua',
-- 'resource/**/shared/*.lua'
}
Expand All @@ -49,6 +50,6 @@ client_scripts {
server_scripts {
'imports/callback/server.lua',
'resource/**/server.lua',
-- 'resource/**/server/*.lua'
'resource/**/server/*.lua',
}

7 changes: 6 additions & 1 deletion locales/al.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Mbylle",
"confirm": "Konfirmo",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Zavřít",
"confirm": "Potvrdit",
"more": "Více..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Schließen",
"confirm": "Bestätigen",
"more": "Mehr..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Close",
"confirm": "Confirm",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Cerrar",
"confirm": "Confirmar",
"more": "Más..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Sulge",
"confirm": "Kinnita",
"more": "Rohkem..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Fermer",
"confirm": "Confirmer",
"more": "Plus..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "סגירה",
"confirm": "אישור",
"more": "...עוד"
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Zatvori",
"confirm": "Potvrdi",
"more": "Više..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Bezárás",
"confirm": "Megerősít",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Tutup",
"confirm": "Konfirmasi",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
13 changes: 9 additions & 4 deletions locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
"language": "Italiano",
"ui": {
"cancel": "Annulla",
"close": "Chiudere",
"confirm": "Confermare",
"more": "Di più..."
}
"close": "Chiudi",
"confirm": "Conferma",
"more": "Altro..."
},
"txadmin_announcement": "Annuncio server da %s",
"txadmin_dm": "Messaggio diretto da %s",
"txadmin_warn": "Sei stato richiamato da %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Riavvio Programmato"
}
7 changes: 6 additions & 1 deletion locales/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Uždaryti",
"confirm": "Patvirtinti",
"more": "Daugiau..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Sluiten",
"confirm": "Bevestig",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
9 changes: 7 additions & 2 deletions locales/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Lukk",
"confirm": "Bekreft",
"more": "Mer..."
}
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Zamknij",
"confirm": "Potwierdź",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Fechar",
"confirm": "Confirmar",
"more": "Mais..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Закрыть",
"confirm": "Подтвердить",
"more": "Ещё..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Zavrieť",
"confirm": "Potvrdiť",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Zapri",
"confirm": "Potrdi",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Stäng",
"confirm": "Acceptera",
"more": "Mer..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "ปิด",
"confirm": "ยืนยัน",
"more": "เพิ่มเติม..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "Kapat",
"confirm": "Onayla",
"more": "Daha Fazla..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "关闭",
"confirm": "确认",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
7 changes: 6 additions & 1 deletion locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"close": "關閉",
"confirm": "確認",
"more": "More..."
}
},
"txadmin_announcement": "Server announcement by %s",
"txadmin_dm": "Direct Message from %s",
"txadmin_warn": "You have been warned by %s",
"txadmin_warn_content": "%s \nAction ID: %s",
"txadmin_scheduledrestart": "Scheduled Restart"
}
44 changes: 44 additions & 0 deletions resource/interface/server/txadmin.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if GetConvarInt('ox:txAdminNotifications', false) then
if GetConvar('txAdmin-hideDefaultAnnouncement', 'false') == 'true' then
AddEventHandler('txAdmin:events:announcement', function(eventData)
TriggerClientEvent('ox_lib:notify', -1, {
id = 'txAdmin:announcement',
title = locale('txadmin_announcement', eventData.author),
description = eventData.message,
duration = 5000
})
end)
end

if GetConvar('txAdmin-hideDefaultDirectMessage', 'false') == 'true' then
AddEventHandler('txAdmin:events:playerDirectMessage', function(eventData)
TriggerClientEvent('ox_lib:notify', eventData.target, {
id = 'txAdmin:playerDirectMessage',
title = locale('txadmin_dm', eventData.author),
description = eventData.message,
duration = 5000
})
end)
end

if GetConvar('txAdmin-hideDefaultWarning', 'false') == 'true' then
AddEventHandler('txAdmin:events:playerWarned', function(eventData)
TriggerClientEvent('ox_lib:alertDialog', eventData.target, {
header = locale('txadmin_warn', eventData.author),
content = locale('txadmin_warn_content', eventData.reason, eventData.actionId),
centered = true
})
end)
end

if GetConvar('txAdmin-hideDefaultScheduledRestartWarning', 'false') == 'true' then
AddEventHandler('txAdmin:events:scheduledRestart', function(eventData)
TriggerClientEvent('ox_lib:notify', -1, {
id = 'txAdmin:scheduledRestart',
title = locale('txadmin_scheduledrestart'),
description = eventData.translatedMessage,
duration = 5000
})
end)
end
end
1 change: 1 addition & 0 deletions resource/shared.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib.locale()

0 comments on commit 8a8700c

Please sign in to comment.