Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announce #381

Merged
merged 2 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions client/gui_c.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions language/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions language/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions language/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions language/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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!",

Expand Down
2 changes: 2 additions & 0 deletions language/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions shared/util_shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down