summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-10-03 12:36:22 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:06 +0000
commit567938d0a588d8e9230e1fe5f9d321c8ddd4aa54 (patch)
tree18cd3dd507332de23311d108fdf265c936223da1 /src
parentdee62e154291901073895a55715124061c61de03 (diff)
* Fix semicolon I forgot during the previous commit
* (bug 3997) Add g_specChat to silence chatty spectators during matches
Diffstat (limited to 'src')
-rw-r--r--src/game/g_cmds.c10
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_main.c2
3 files changed, 13 insertions, 0 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index ae48940d..8dede827 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -723,6 +723,16 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
else
prefix = "";
+ // check if blocked by g_specChat 0
+ if( ( !g_specChat.integer ) && ( mode != SAY_TEAM ) &&
+ ( ent ) && ( ent->client->pers.teamSelection == TEAM_NONE ) &&
+ ( !G_admin_permission( ent, ADMF_NOCENSORFLOOD ) ) )
+ {
+ trap_SendServerCommand( ent-g_entities, va( "print \"Global chatting for "
+ "spectators has been disabled. You may only use team chat.\n\"") );
+ return;
+ }
+
switch( mode )
{
default:
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 8aea02dc..5084fe8c 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1184,6 +1184,7 @@ extern vmCvar_t g_adminTempBan;
extern vmCvar_t g_dretchPunt;
extern vmCvar_t g_privateMessages;
+extern vmCvar_t g_specChat;
extern vmCvar_t g_publicAdminMessages;
void trap_Print( const char *fmt );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 8146f03f..0bda0a97 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -142,6 +142,7 @@ vmCvar_t g_adminTempBan;
vmCvar_t g_dretchPunt;
vmCvar_t g_privateMessages;
+vmCvar_t g_specChat;
vmCvar_t g_publicAdminMessages;
vmCvar_t g_tag;
@@ -273,6 +274,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_dretchPunt, "g_dretchPunt", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_privateMessages, "g_privateMessages", "1", CVAR_ARCHIVE, 0, qfalse },
+ { &g_specChat, "g_specChat", "1", CVAR_ARCHIVE, 0, qfalse },
{ &g_publicAdminMessages, "g_publicAdminMessages", "1", CVAR_ARCHIVE, 0, qfalse },
{ &g_tag, "g_tag", "main", CVAR_INIT, 0, qfalse },