Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Identify Player's Channels?

Asked by
Vezious 310 Moderation Voter
6 years ago
Edited 6 years ago

So I am creating a chat system that includes Channels.

There are 2 different types of Channels, Direct Messages(DMs) and Groups.

I was thinking about storing each one in a table of channels, however, I don't really know how I would find a player's correct channel that they would want to send a message. Someone did tell me that I should make another table for each player and store a reference of their channels. This would work for DMs as the player could just send the name of the Player they want to message, but not for groups. I could do the same for groups but that doesn't seem very good.

local Channels = {}

local PlayersChannels = {} -- Look through channels to see if there is a DM channel with target player "Ugly_DrugDealingNinja"

So then I thought, maybe I should provide the players a way to name their group, but then you couldn't have more than 1 group with the same name.

local Channels = {
    ["The3PlayerGroup"] = {}
    ["BroItsaGroup"] = {}
}


local Group = Channels[Name] 

Is there another way without forcing the group to have a name and possibly a way for DMs not to require a different table?

Answer this question