Making a group chat for different 'teams'
So I have a sever up and coming.
I am wondering, with making sort of 'team' chats.
With that code for making normal team chats, am I right in saying you can make different chat commands and link them to each group in a way?
Pretty much want a chat such as gangsters and thiefs could talk to eachother in secret with /crime hey and police and the mayor with /cp hey
local function CRIME(ply, args)
if args == "" then return "" end
local DoSay = function(text)
if text == "" then return end
local t = ply:Team()
local audience = {}
if t == TEAM_ROBBER or t == TEAM_THIEF or t == TEAM_MAFIA or t == TEAM_GANGSTER then
for k, v in pairs(player.GetAll()) do
local vt = v:Team()
if vt == TEAM_ROBBER or vt == TEAM_THIEF or vt == TEAM_MAFIA or vt == TEAM_GANGSTER then table.insert(audience, v) end
end
end
for k, v in pairs(audience) do
local col = team.GetColor(ply:Team())
TalkToPerson(v, col, LANGUAGE.group..ply:Nick(),Color(255,255,255,255), text, ply)
end
end
return args, DoSay
end
AddChatCommand("/crime", CRIME)
is this how?
Take a look at this example https://mtxserv.com/gmod-server/doc/how-to-add-ano-command and rewrite it, so it only prints to your desired team(s).