![]() I have some test code that can also serve as a guiding line if you need that, though I trust that you already have your own way of doing this and you just needed to know how to stop messages from being sent to anyone except themselves.ĭo not run this from the command bar. The rest of the effort will now come from you to determine how to insert and toggle the shadow ban tag in the ChatSpeaker object. Speaker is fine, continue processing message Speaker was shadow banned, stop processing message Speaker:SendMessage(message, channelName, speakerName, message.ExtraData) If neither exists, we're safe to continue processing via other methods ![]() Local channel = ChatService:GetChannel(channelName) Local speaker = ChatService:GetSpeaker(speakerName) Get the speaker and the channel they sent a message in To skip some time on unnecessary explanations and all, I’ve supplied the complete code with comments throughout so you can understand what’s going into this ChatModule and what each step will contribute towards making this system work. If they do, then we’ll swallow the chat but continue to show it to them. Since I assume your shadow ban command will act directly on ChatSpeakers (which I can cover a bit later), we’re just going to perform a few simple checks on the ChatSpeaker regarding whether or not they have a shadow ban tag. Local function ProcessMessage(speakerName, message, channelName)ĬhatService:RegisterProcessCommandsFunction("swallow_shadow_ban_chat", ProcessMessage)Įverything happens within the ProcessMessage function. Boilerplate code: local function Run(ChatService) ChatModules typically return a function that will be called by the ChatService internally, passing itself to said function. We’ll need at the very least the boilerplate for ChatModules (which should ideally be consistent). It’s all about editing the module from here. When finished with the above setup, you should have a Chat service looking like this: You’ll also want your module that tackles shadow bans, so you can go ahead and insert that as well. This tells the Lua Chat System to fill the folder with the missing components at runtime. Add a BoolValue called InsertDefaultModules and make sure the value is checked off. Start by creating the ChatModules folder in Chat. ![]() You will need to create some of the directories that the Lua Chat System relies on, but you won’t need to fork anything. So with that in mind, we can get started on working to build this system. The idea is to swallow the chat but still send it to the client anyway. Since shadow banning is a server-side action, we also want to keep this system contained with the server. ![]() You can find more information on the documentation page I linked. ![]() They run their respective functions, but also tell the ChatService not to continue processing the message. We also have the ability to stop a chat from being processed through a command function by returning true.Įver wonder why you can use /mute or /e without it showing up in the chat window? These are command functions. In the case of command functions, each of them are ran to process chats. ChatModules will be run by the server to configure or extend the chat system. Although I haven’t ever made a shadow ban feature myself, I know it is possible to accomplish a feature like this.Ĭommand functions will be your friend here. I’ve worked quite a bit with the Lua Chat System. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |