DarkRP:Group Chat

From Official DarkRP Wiki
Jump to: navigation, search
DarkRP: Group Chat
Page white text.png Description:How to create your very own group chats as well as edit the default ones.
File:User.png Original Author:Drakehawke & Bo98
File:Table edit.png Updated:13th May 2013 (rewrite), 5th October 2013 (DarkRP 2.5.0)
This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | France-flag.png Français

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(<LIST OF TEAMS, SEPARATED BY COMMAS>)

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)