summaryrefslogtreecommitdiff
path: root/src/game/g_cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/g_cmds.c')
-rw-r--r--src/game/g_cmds.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 7903590f..56617697 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -921,6 +921,14 @@ static void Cmd_Say_f( gentity_t *ent )
return;
}
+ // support parsing /a out of say text for the same reason
+ if( !Q_stricmpn( args, "say /a ", 7 ) ||
+ !Q_stricmpn( args, "say_team /a ", 12 ) )
+ {
+ G_AdminMessage( ent );
+ return;
+ }
+
if( trap_Argc( ) < 2 )
return;
@@ -3079,6 +3087,7 @@ commands_t cmds[ ] = {
{ "vsay_local", CMD_MESSAGE|CMD_INTERMISSION, Cmd_VSay_f },
{ "m", CMD_MESSAGE|CMD_INTERMISSION, G_PrivateMessage },
{ "mt", CMD_MESSAGE|CMD_INTERMISSION, G_PrivateMessage },
+ { "a", CMD_MESSAGE|CMD_INTERMISSION, G_AdminMessage },
{ "score", CMD_INTERMISSION, ScoreboardMessage },
@@ -3415,3 +3424,60 @@ void G_PrivateMessage( gentity_t *ent )
}
}
+/*
+=================
+G_AdminMessage
+
+Send a message to all active admins
+=================
+*/
+void G_AdminMessage( gentity_t *ent )
+{
+ char cmd[ 12 ];
+ char prefix[ 50 ];
+ char *msg;
+ int skiparg = 0;
+
+ // Check permissions and add the appropriate user [prefix]
+ if( !ent )
+ {
+ Com_sprintf( prefix, sizeof( prefix ), "[CONSOLE]:" );
+ }
+ else if( !G_admin_permission( ent, ADMF_ADMINCHAT ) )
+ {
+ if( !g_publicAdminMessages.integer )
+ {
+ ADMP( "Sorry, but use of /a by non-admins has been disabled.\n" );
+ return;
+ }
+ else
+ {
+ Com_sprintf( prefix, sizeof( prefix ), "[PLAYER]%s" S_COLOR_WHITE ":", ent->client->pers.netname );
+ ADMP( "Your message has been sent to any available admins and to the server logs.\n" );
+ }
+ }
+ else
+ {
+ Com_sprintf( prefix, sizeof( prefix ), "[ADMIN]%s" S_COLOR_WHITE ":", ent->client->pers.netname );
+ }
+
+ // Parse out say/say_team if this was used from one of those
+ G_SayArgv( 0, cmd, sizeof( cmd ) );
+ if( !Q_stricmp( cmd, "say" ) || !Q_stricmp( cmd, "say_team" ) )
+ {
+ skiparg = 1;
+ G_SayArgv( 1, cmd, sizeof( cmd ) );
+ }
+ if( G_SayArgc( ) < 2 + skiparg )
+ {
+ ADMP( va( "usage: %s [message]\n", cmd ) );
+ return;
+ }
+
+ msg = G_SayConcatArgs( 1 + skiparg );
+
+ // Send it
+ G_AdminsPrintf( prefix, "%s\n", msg );
+
+}
+