Group chat

Hi,

I am trying to set up a command that allows people to contact a superadmin if online through chat, and only super admin can see such chat. I have a piece of code that grabs the players ID 5 seconds after NetworkIsSessionStarted() and it is supposed to save this players ID to the table inside the server code. Once someone enters the command ‘/sc xxxx’ it should send a message to only the players in the table. How would i go about this? What i have doesnt work.

local staff = {}
RegisterServerEvent('properload')
AddEventHandler('properload', function()
	player = GetPlayerIdentifiers(source)[1]
	local result = MySQL.Sync.fetchAll(
	  'SELECT * FROM users WHERE identifier = @identifier',
	  {
		['@identifier'] = player
	  }
	)
	for i=1, #result, 1 do
		if result[i].group == 'superadmin' then
			table.insert(staff, {label = 'id', value = source})
		end
	end
end)

AddEventHandler('chatMessage', function(source, name, msg)
	sm = stringsplit(msg, " ");
		if sm[1] == "/sc" then
			for index, value in ipairs(staff) do
				TriggerClientEvent('chatMessage', value, "**STAFF**", {255, 0, 125}, string.sub(msg,4))
			end
		end
end)

This could be really well developed. Maybe a /reply, so they can have a conversation. Maybe other “superadmins” could get in on the conversation. I really like this idea.

Keep at it <3

I saw already a couple of servers that actually have the /a channel chat for /admins group, you should keep looking for it to see if someone is sharing his script or keep asking around who has one.

By the other hand, I came here to read because I thought you was asking also for other kind of group chats.

This is because I was wondering if it is possible to create a spontaneous party of players when you are in a server so you can have some sort of /group chat channel in order to chat only with them.

This also opens the possibilities to have faction chats for gangs and that kind of stuff but, again, since there’s already the /admin chat channel implemented and of course you have as well the /cops chat channel, it seems is pretty easy to assign exclusive chat channels for each different group.

Still, I think if we could have a feature that allow us to create a “group of players” (not talking about the server group categories that is already in place in the server.cfg file) would be a very socializing-wise function in order to create groups with any players you want to implement later any other related functions and mainly keep the chat hud cleaner than it is when it comes to have a bunch of people talking about their personal life mixed with newbies (like me) asking for help and the all-time-veterans who already knows it all spamming “read the forums”, “learn the rules” and so on and Johnny Doe asking 'Where are you Peter, I’m coming" and blah, blah…lol

See below link for the first draft/release of the code