Originally Posted by Garan
I created a chat system for the multi-player Cards game (unpublished). This would not be spam as it would be broadcast to a channel that players have voluntarily chosen to accept. There are however a couple of issues that have to be considered.
First, you have to determine which chat channel number your channel is on each client. Since you can't really control which channels the user already has in use, you will have to determine that at run time. This isn't too complicated, it just requires a /listchannels command in a button on your interface, then you parse the response to see if your channel already exists, if not, you present a /joinchannel button that joins the channel. You could skip the /listchannels, but then if the user did already have your channel set the response to a join is just 'You are already in room 'whatever'' without telling you which channel number so your plugin wouldn't know which number to use without first dropping the channel and re-adding it - it is simpler to just use the /listchannels to see if it is already being used and determine the channel id from that.
Unfortunately, it would be possible for someone to maliciously lock you (and any users of your plugin) out of your chosen chat channel after a server restart. We had issues with this occurring with the old glff channel on occaision - a malicious user would get in shortly after the server came up and create the channel with a password, effectively locking all other users out. Unfortunately, creating your channel with a password does not protect against this as all user chat channels are wiped when the last user leaves and the next join command creates a new channel (with whatever optional password they specify).
The second issue I haven't tested lately, but it used to be that you have to make sure your users have the specific user chat channel selected in the chat channel filters for at least one chat tab or the user won't get the messages (and your plugin won't either). I believe this is still the current rule.
These buttons can simply be displayed in a Chat Settings window that is only opened as needed to configure the plugin initially. I also allowed users to specify their own channel name there so that they could hold private games with more than 24 players/spectators.
FWIW, the chat system worked fine, I suspended development of the game system because it was far too easy for players to cheat. I toyed with a number of solutions to the cheating issue but none of them were satisfactory so I scrapped it but the user chat subsystem was a sound idea for cross client plugin communication.
Thank you for that, it would only form a tiny part of the project, so might add in a later update.
One other question, I've been struggling to recieve the message when I've sent a tell to someone else, but works fine the other way, do you know of a way to fix that? Thanks