[Release] EssentialMode chat commands for es_admin2 - /me, /do /911 /occ /news /advert

some have asked for the old ones to be moved into the new es_admin2 for fx server here some that i done up i still got more to come back you can add what you like to yours just using this layout.

TriggerEvent(‘es:addCommand’, ‘ooc’, function(source, args, user)
table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, -1, “^6OCC”, {255, 0, 0}, " ^0 " … GetPlayerName(source) …" “…”^0 " … table.concat(args, " "))
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end, {help = “talk out of rp”, params = {{name = “ooc”, help = “To talk out of rp”}}})

TriggerEvent(‘es:addCommand’, ‘advert’, function(source, args, user)
table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, -1, “^6Advert”, {255, 0, 0}, " ^1 " … GetPlayerName(source) …" “…”^1 " … table.concat(args, " "))
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end, {help = “Announce a advert to the entire server”, params = {{name = “advert”, help = “The message to advert”}}})

TriggerEvent(‘es:addCommand’, ‘me’, function(source, args, user)
table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, -1, “”, {255, 0, 0}, " ^6 " … GetPlayerName(source) …" “…”^6 " … table.concat(args, " "))
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end, {help = “Announce a message to the entire server”, params = {{name = “me”, help = “do a me in chat”}}})

TriggerEvent(‘es:addCommand’, ‘do’, function(source, args, user)
table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, -1, “^5Action”, {255, 0, 0}, " ^0* " … GetPlayerName(source) …" “…”^0 " … table.concat(args, " "))
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end, {help = “Announce a action”, params = {{name = “do”, help = “The message to announce”}}})

TriggerEvent(‘es:addCommand’, ‘news’, function(source, args, user)
table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, -1, “^6News”, {255, 0, 0}, " ^0 " … GetPlayerName(source) …" “…”^0 " … table.concat(args, " "))
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end, {help = “Announce a message to the entire server”, params = {{name = “news”, help = “The message to announce”}}})

TriggerEvent(‘es:addCommand’, ‘911’, function(source, args, user)
table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, -1, “^6911”, {255, 0, 0}, " ^0 " … GetPlayerName(source) …" “…”^0 " … table.concat(args, " "))
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end, {help = “send a 911”, params = {{name = “911”, help = “The message to announce”}}})


add to your server.lua in es_admin2

1 Like

Although I will not be needing this it is still a very heloful release to a lot of community members, nice work!

thanks just thought i help as people been asking

thx brother it is for sure helpful

unfortunetly it wont really work if you have a modified chat example you have roles and stuff

this work just as es_admin2 commands

i know i have a separate resource for this to be honest even that wont work very well with some custom chats

Not so sure what that is Many many Errors but i Belive this is what your after

-- ME 
TriggerEvent('es:addCommand', 'me', function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('chatMessage', source, "ME", {255, 0, 0}, " (^6" .. 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() > 0 and k ~= source)then
					TriggerClientEvent('chatMessage', k, "REPORT", {255, 0, 0}, " (^2" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))
				end
			end)
		end
	end)
end, {help = "Announce a message to the entire server", params = {{name = "me", help = "do a me in chat"}}})

-- do
TriggerEvent('es:addCommand', 'do', function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('chatMessage', source, "Action", {255, 0, 0}, " (^1" .. 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() > 0 and k ~= source)then
					TriggerClientEvent('chatMessage', k, "REPORT", {255, 0, 0}, " (^2" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))
				end
			end)
		end
	end)
end, {help = "Announce a Action to the entire server", params = {{name = "do", help = "do a Action in chat"}}})

-- tweet
TriggerEvent('es:addCommand', 'tweet', function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('chatMessage', source, "tweet", {255, 0, 0}, " (^5" .. 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() > 0 and k ~= source)then
					TriggerClientEvent('chatMessage', k, "REPORT", {255, 0, 0}, " (^2" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))
				end
			end)
		end
	end)
end, {help = "Sent a tweet to the entire server", params = {{name = "tweet", help = "Send a Tweet in chat"}}})

--Advert
TriggerEvent('es:addCommand', 'advert', function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('chatMessage', source, "advert", {255, 0, 0}, " (^5" .. 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() > 0 and k ~= source)then
					TriggerClientEvent('chatMessage', k, "REPORT", {255, 0, 0}, " (^2" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))
				end
			end)
		end
	end)
end, {help = "Sent a Advertisment to the entire server", params = {{name = "advert", help = "Send a Advertisement in chat"}}})

--News
TriggerEvent('es:addCommand', 'News', function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('chatMessage', source, "News", {255, 0, 0}, " (^4" .. GetPlayerName(source) .." | "..source.."^4) " .. table.concat(args, " "))

	TriggerEvent("es:getPlayers", function(pl)
		for k,v in pairs(pl) do
			TriggerEvent("es:getPlayerFromId", k, function(user)
				if(user.getPermissions() > 0 and k ~= source)then
					TriggerClientEvent('chatMessage', k, "News", {255, 0, 0}, " (^4" .. GetPlayerName(source) .." | "..source.."^4) " .. table.concat(args, " "))
				end
			end)
		end
	end)
end, {help = "Sent  News to the entire server", params = {{name = "News", help = "Send  News in chat"}}})

--OOC
TriggerEvent('es:addCommand', 'OOC', function(source, args, user)
	table.remove(args, 1)
	TriggerClientEvent('chatMessage', source, "OOC", {255, 255, 255}, " (^5" .. 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() > 0 and k ~= source)then
					TriggerClientEvent('chatMessage', k, "OOC", {255, 255, 255}, " (^0" .. GetPlayerName(source) .." | "..source.."^0) " .. table.concat(args, " "))
				end
			end)
		end
	end)
end, {help = "Sent a OOC to the entire server", params = {{name = "OOC", help = "Send a OOC in chat"}}})

i dont get any at all @ John_Dark and you done it wrong that not how they work

You did it wrong bud…

i did nothing wrong cause there working fine for me and there setup right

TriggerEvent(‘es:addCommand’, ‘ooc’, function(source, args, user)
table.remove(args, 1)
TriggerClientEvent(‘chatMessage’, -1, “^6OCC”, {255, 0, 0}, " ^0 " … GetPlayerName(source) …" “…”^0 " … table.concat(args, " "))
end, function(source, args, user)
TriggerClientEvent(‘chatMessage’, source, “SYSTEM”, {255, 0, 0}, “Insufficienct permissions!”)
end, {help = “talk out of rp”, params = {{name = “ooc”, help = “To talk out of rp”}}})

there setup like this cause there going to everyone and there not going back to a admin

works good for me on essential 4.6.3 and FX server
https://gyazo.com/61b4f325dd0e0d1273486ddd4a86a073

ahh yes i left permissions in my bad

1 Like

as i said there setup right i fix them up now i just posted a base jump script to. also updated my post to fix it and added a 911

These don’t seem to work for me I just get errors in chat after entering the commands?

Any small tips on where to exactly post this in the server.lua?
Can I just copy/paste it at the bottom or any specific place?

Getting
“Error parsing script server.lua in resource es_admin2: server.lua:518: unexpected symbol near ‘<\226>’”

I know I must be doing something wrong, but the question is what :slight_smile:

Thanks!

just pop them under announce

Thanks look just what im looking for!
+rep

Where exactly would i put this on a vRP server? Would esadmin_2 work in vRP?