summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-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 },