[Release] Admin Announcement

i have tried that bud

m8 it works perfectly :wink:

AddEventHandler('chatMessage', function(source, name, msg)
	sm = stringsplit(msg, " ");
	if sm[1] == "/announce" then
        CancelEvent()
        TriggerClientEvent("chatMessage", -1, "^4Admin Announcement", {255, 255, 255}, string.sub(msg,10))
    end
	sm = stringsplit(msg, " ");
	if sm[1] == "/oannounce" then
        CancelEvent()
        TriggerClientEvent("chatMessage", -1, "^2Owner Announcement", {255, 255, 255}, string.sub(msg,11))
    end
end)
function stringsplit(inputstr, sep)
    if sep == nil then
        sep = "%s"
    end
    local t={} ; i=1
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        t[i] = str
        i = i + 1
    end
    return t
end

work like a charm :roll_eyes:

also remove the part from "end " to sm = stringsplit thats so unnecessary
just use elseif

AddEventHandler('chatMessage', function(source, name, msg)
	sm = stringsplit(msg, " ");
	if sm[1] == "/announce" then
        CancelEvent()
        TriggerClientEvent("chatMessage", -1, "^4Admin Announcement", {255, 255, 255}, string.sub(msg,10))
	elseif sm[1] == "/oannounce" then
        CancelEvent()
        TriggerClientEvent("chatMessage", -1, "^2Owner Announcement", {255, 255, 255}, string.sub(msg,11))
    end
end)
function stringsplit(inputstr, sep)
    if sep == nil then
        sep = "%s"
    end
    local t={} ; i=1
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        t[i] = str
        i = i + 1
    end
    return t
end

thank you sir for the suggetion

Hey, I want Admin Announcement but I don’t know how to do it so please can you help me.

You SERIOUSLY should add an Steam ID verification to see who’s an admin and who’s not since this doesn’t mean anything without it.

I might be completely mistaken, but I think that there’s already a command called /announce that’s in fivem as default? Or maybe it’s included in ESX or something

It is in es_admin2. :wink:

Sure join the discord and i can help https://discord.gg/FTWfs36

Thats included in another one

Actually its in essential mode cause I tried using /announce in my server with es2admin in only and nothing happened

Also help @Edge-jelly it does not work for me

I did not edit it at all but for some weird reason /adminannounce won’t work on my server

So sorry for the delay


join my discord and i can help you out

Your discord link is invalid

looks great!