DarkRP:Group Chat

Here I'm going to show you how you can create your own group chats, or add jobs to the current ones.

Go to lua/darkrp_customthings/groupchats.lua (see here), and you will find something similar to this: --[[--- Group chats --- Team chat for when you have a certain job. e.g. with the default police group chat, police officers, chiefs and mayors can talk to one another through /g or team chat.

HOW TO MAKE A GROUP CHAT: Simple method: GAMEMODE:AddGroupChat(List of team variables separated by comma)

Advanced method: GAMEMODE:AddGroupChat(a function with ply as argument that returns whether a random player is in one chat group) This is for people who know how to script Lua. ---]] -- Example: GAMEMODE:AddGroupChat(TEAM_MOB, TEAM_GANG) -- Example: GAMEMODE:AddGroupChat(function(ply) return ply:isCP end)

This is the file we're going to be working with.

Editing the current group chats:
Group chats can be set up using a function or with team names.

Let's say we want to add our custom team, TEAM_SWAT to the police group chat. The police chat is not a list of teams but a function returning true if the player is a CP. To add TEAM_SWAT to this chat, we need to set the team as a CP team. This page will tell you how you can do so.

Now let's say we want to add another custom team, TEAM_THIEF to the gang group chat. This time it is simply a list of teams so we can simply add TEAM_THIEF by adding this:

GAMEMODE:AddGroupChat(TEAM_MOB, TEAM_GANG, TEAM_THIEF)

and disabling the default in lua/darkrp_config/disabled_defaults.lua:

DarkRP.disabledDefaults["groupchat"] = { [1] = false, -- Police group chat (mayor, cp, chief and/or your custom CP teams) [2] = true, -- Group chat between gangsters and the mobboss }

Simple.

To create your own group chat:
To add your own group chat, use the template below:

GAMEMODE:AddGroupChat()

Here I have set up a third group chat for hobos:

GAMEMODE:AddGroupChat(TEAM_HOBO)

And here I have set up a fourth group chat for cooks and gun dealers:

GAMEMODE:AddGroupChat(TEAM_COOK, TEAM_GUN)