diff --git a/client/gui_c.lua b/client/gui_c.lua index c60f4234..d4592801 100644 --- a/client/gui_c.lua +++ b/client/gui_c.lua @@ -951,6 +951,18 @@ function GenerateMenu() -- this is a big ass function if DoesPlayerHavePermissionForCategory(-1, "server") then + if permissions["server.announce"] then + local thisItem = NativeUI.CreateItem(GetLocalisedText("announcement"), GetLocalisedText("announcementguide")) + servermanagement:AddItem(thisItem) + thisItem.Activated = function(ParentMenu,SelectedItem) + local result = displayKeyboardInput("FMMC_KEY_TIP8", "", 128) + + if result then + TriggerClientEvent("EasyAdmin:Announce", result) + end + end + end + if permissions["server.convars"] then local thisItem = NativeUI.CreateItem(GetLocalisedText("setgametype"), GetLocalisedText("setgametypeguide")) servermanagement:AddItem(thisItem) diff --git a/language/de.json b/language/de.json index 32bbab54..a07a97f8 100644 --- a/language/de.json +++ b/language/de.json @@ -97,6 +97,8 @@ "nongiven": "Keinen gegeben", "newadmin": "Du bist jetzt ein Admin", "announcement": "Announcement", + "announcementguide": "Send an announcement to all players", + "adminannouncement": "**%s** sent an announcement: **%s**", "playernotfound": "Spieler wurde nicht gefunden.", "done": "Fertig!", "adminkickedplayer": "**%s** hat **%s** gekickt, Grund: %s", diff --git a/language/en.json b/language/en.json index e8b96c16..bdec26ef 100644 --- a/language/en.json +++ b/language/en.json @@ -96,6 +96,8 @@ "nongiven": "None Provided", "newadmin": "You are now an Admin", "announcement": "Announcement", + "announcementguide": "Send an announcement to all players", + "adminannouncement": "**%s** sent an announcement: **%s**", "playernotfound": "Player could not be found.", "done": "Done!", "adminkickedplayer": "**%s** kicked **%s**, Reason: %s", diff --git a/language/es.json b/language/es.json index 7c7336c6..c18bfd8c 100644 --- a/language/es.json +++ b/language/es.json @@ -96,6 +96,8 @@ "nongiven": "No se ha proporcionado", "newadmin": "Ahora eres administrador", "announcement": "Anuncio", + "announcementguide": "Send an announcement to all players", + "adminannouncement": "**%s** sent an announcement: **%s**", "playernotfound": "No se ha encontrado al jugador.", "done": "Hecho", "adminkickedplayer": "**%s** a kickeado a **%s**, Razon: %s", diff --git a/language/fr.json b/language/fr.json index 2eb43124..2e57a384 100644 --- a/language/fr.json +++ b/language/fr.json @@ -97,6 +97,8 @@ "nongiven": "Non autorisé", "newadmin": "Vous êtes maintenant un administrateur", "announcement": "Announcement", + "announcementguide": "Send an announcement to all players", + "adminannouncement": "**%s** sent an announcement: **%s**", "playernotfound": "Le joueur n'a pas été trouvé.", "done": "Fait!", "adminkickedplayer": "**%s** a expulser **%s**, Raison: %s", diff --git a/language/it.json b/language/it.json index 6be6a96a..6ee8b820 100644 --- a/language/it.json +++ b/language/it.json @@ -96,6 +96,8 @@ "nongiven": "Non fornito", "newadmin": "Sei ora un amministratore", "announcement": "Announcement", + "announcementguide": "Send an announcement to all players", + "adminannouncement": "**%s** sent an announcement: **%s**", "playernotfound": "Giocatore non trovato.", "done": "Fatto!", "adminkickedplayer": "**%s** Ha espulso **%s**, Motivo: %s", diff --git a/language/nl.json b/language/nl.json index 0a2673e4..158c26c0 100644 --- a/language/nl.json +++ b/language/nl.json @@ -98,6 +98,8 @@ "nongiven": "Geen reden opgegeven", "newadmin": "Je bent nu Admin", "announcement": "Mededeling", + "announcementguide": "Stuur een mededeling naar alle spelers", + "adminannouncement": "**%s** stuurde een mededeling: **%s**", "playernotfound": "Speler kan niet gevonden worden.", "done": "Gedaan!", diff --git a/language/pl.json b/language/pl.json index f2b86fc6..48309dce 100644 --- a/language/pl.json +++ b/language/pl.json @@ -96,6 +96,8 @@ "nongiven": "Nie podano", "newadmin": "Jesteś teraz Adminem", "announcement": "Ogłoszenie", + "announcementguide": "Send an announcement to all players", + "adminannouncement": "**%s** sent an announcement: **%s**", "playernotfound": "Nie można znaleźć gracza.", "done": "Zrobione!", "adminkickedplayer": "**%s** wyrzucił **%s**, Powód: %s", diff --git a/server/admin_server.lua b/server/admin_server.lua index 6feee0ed..859d4623 100644 --- a/server/admin_server.lua +++ b/server/admin_server.lua @@ -550,6 +550,15 @@ Citizen.CreateThread(function() SendWebhookMessage(preferredWebhook,string.format(GetLocalisedText('adminchangedconvar'), getName(source, false, true), convarname, convarvalue), "settings", 16777214) end end) + + RegisterServerEvent("EasyAdmin:Announce", function(text) + if DoesPlayerHavePermission(source, "server.announce") then + PrintDebugMessage("Player "..getName(source,true).." sent a announcement: "..text, 3) + announce(text) + local preferredWebhook = detailNotification ~= "false" and detailNotification or moderationNotification + SendWebhookMessage(preferredWebhook,string.format(GetLocalisedText('adminannouncement'), getName(source, false, true), text), "settings", 16777214) + end + end) ------------------------------ COMMANDS diff --git a/shared/util_shared.lua b/shared/util_shared.lua index 7c56b75c..0979ab92 100644 --- a/shared/util_shared.lua +++ b/shared/util_shared.lua @@ -24,6 +24,7 @@ permissions = { ["server.permissions.write"] = false, ["server.shortcut.add"] = false, ["server.reminder.add"] = false, + ["server.announce"] = false, ["server.convars"] = false, ["server.resources.start"] = false, ["server.resources.stop"] = false,