[Essentials][es_admin] Simple Admin Chat

Hello, my name is Shrike and I have made a very simple admin chat by taking the report command and changing the permissions and making it a Admin Chat.

-- Admin Chat by ShrikeGT --
TriggerEvent('es:addCommand', 'achat', function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('chatMessage', source, "Admin Chat", {255, 0, 0}, " (^3" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))

	TriggerEvent("es:getPlayers", function(pl)
		for k,v in pairs(pl) do
			TriggerEvent("es:getPlayerFromId", k, function(user)
				if(user.getPermissions() >= 5 and k ~= source)then
					TriggerClientEvent('chatMessage', k, "Admin Chat", {255, 0, 0}, " (^3" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))
				end
			end)
		end
	end)
end, {help = "Talk to fellow admins.", params = {{name = "achat", help = "What do you need to tell other admins?"}}})

Very simple and easy to use, do /achat and type your message.

It is currently set to anyone with the permission level >= 5.
To change that simply change | if(user.getPermissions() > 5 and k ~= source)then | to whatever level you want.

Installation:

Go into your es_admin2 folder
Open server.lua
Scroll to the very bottom
and paste BEFORE loadBans()

end, {help = "Talk to fellow admins.", params = {{name = "achat", help = "What do you need to tell other admins?"}}})

loadBans()

Should look like this ^

Done.

If you need any help or have any questions feel free to comment below and Ill try by best. I am by no means a lua coder, I just used common sense and edited the report command

Update 1.1 - made it > or = to permission level _. Instead of just greater than.

2 Likes

Are you able to make this standalone? using the aces permission system?

Not to sure what aces permission system is but if you link me I will take a look.

Looks good man.

Great work.

1 Like

TriggerEvent(‘es:addCommand’, ‘achat’, function(source, args, user)
–table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, source, “Admin Chat”, {255, 0, 0}, " (^3" … GetPlayerName(source) …" | “…source…”^0) " … table.concat(args, " "))

TriggerEvent("es:getPlayers", function(pl)
	for k,v in pairs(pl) do
		TriggerEvent("es:getPlayerFromId", k, function(user)
			if(user.getPermissions() >= 5 and k ~= source)then
				TriggerClientEvent('chatMessage', k, "Admin Chat", {255, 0, 0}, " (^3" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))
			end
		end)
	end
end)

end, {help = “Talk to fellow admins.”, params = {{name = “achat”, help = “What do you need to tell other admins?”}}})

Fixed for chat bugs.

I got it to work, BUT I dont see a message.

Si I type /achat test ingame, I see the message popup, not the actual message.
image