How To

Adding Custom Chat Feautures To mChat Resource

How To Add Chat Messages

To add custom messages you need knowledge on development otherwise we don't advise you to try this

      -- Please be aware this is a server-side example
        local messageData = {
            args = {GetPlayerRoleplayName(source), message}, -- first index is author name second one is message (author name is not required you can just put message too)
            tags = {"ooc", "police"}, -- tags that will shown in the message (you can see all avaliables tags in Config.Tags or you can add your own custom tag in Config.Tags)
            playerId = source, -- Server ID of the message owner (this is not required you can just delete this if you don't have an id)
            channel = 'ooc', -- Channel name that message will be sent (default channels are "ooc", "me", "do", "pm", "server")
        }
        TriggerClientEvent('chat:addMessage', -1, messageData)

How To Add Chat Channel

How do I add new channels and give access to players or remove access from players.

To add custom channels you need knowledge on development otherwise we don't advise you to try this

-- Please be aware this is a server-side example

-- Give access and create channel for player
TriggerClientEvent('mChat:ToggleCustomChatAccess', source, {
    name = 'mycustomchannel', -- channel name 
    label = "CUSTOM_CHANNEL", -- channel label
    show = true,
})

-- Remove access and delete channel from player
TriggerClientEvent('mChat:ToggleCustomChatAccess', source, {
    name = 'mycustomchannel', -- channel name 
    show = false, 
})

How To Add Chat Tags With Discord Roles

Enable Config.EnableDiscordRoles in Config (it comes disabled by default).

If developer mode is not enabled in your discord account enable it

Right click on your server and copy server id then paste it into here (file can be find server/discordroles.lua ).

Create a bot token and paste it into here. If you dont know how to get your discord bot token go this link. https://www.youtube.com/watch?v=-m-Z7Wav-fM&ab_channel=GAKventure

Copy and paste role id in members table that can be find in Config.Tags.

Last updated