[Release] Admin Announcement

So anyone can use it then?

well if they know the command
you can change the command if you like look at read me

Oh right, thanks.
[20 characters]

and it btw i am workign to get more but you can only have 4 character

Ok
Thanks for releasing

lol you can have more, learn abit about coding and then talk
change this > (msg,5)), to use more letters in the command

ok sir you change that yeah tell me if it works

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