diff options
author | MaeJong <mewiceclair@gmail.com> | 2017-05-02 18:36:16 +0200 |
---|---|---|
committer | MaeJong <mewiceclair@gmail.com> | 2017-05-02 18:36:16 +0200 |
commit | f6bb5ea062f5ff3d83fc9e73e20487d7f7334c04 (patch) | |
tree | d44fa09527e1995b7d658bb201398930dc2126e7 | |
parent | 3bdef682e03faf52a4eec10af06960ec4b467af5 (diff) |
Implement high admin chat
The channel is accessible to anyone who has the flag HIGHADMINCHAT, via
/say_hadmins or /ha
-rw-r--r-- | src/game/g_admin.c | 1 | ||||
-rw-r--r-- | src/game/g_admin.h | 2 | ||||
-rw-r--r-- | src/game/g_cmds.c | 29 | ||||
-rw-r--r-- | src/game/g_svcmds.c | 5 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 1 |
5 files changed, 37 insertions, 1 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 296d403..2de9296 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -7351,6 +7351,7 @@ static AdminFlagListEntry_t adminFlagList[] = { { ADMF_ACTIVITY, "inactivity rules do not apply" }, { ADMF_ADMINCHAT, "can see and use admin chat" }, + { ADMF_HIGHADMINCHAT, "can see and use high admin chat" }, { ADMF_ALLFLAGS, "has all flags and can use any command" }, { ADMF_BAN_IMMUNITY, "immune from IP bans" }, { ADMF_CAN_PERM_BAN, "can permanently ban players" }, diff --git a/src/game/g_admin.h b/src/game/g_admin.h index 0850cea..d980ba8 100644 --- a/src/game/g_admin.h +++ b/src/game/g_admin.h @@ -69,6 +69,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * IMMUTABLE - admin commands cannot be used on them * INCOGNITO - does not show up as an admin in !listplayers * ADMINCHAT - receives and can send /a admin messages + * HIGHADMINCHAT - receives and can send /ha high admin messages * SEESFULLLISTPLAYERS - sees all information in !listplayers * DBUILDER - permanent designated builder * STEALTH - uses admin stealth @@ -90,6 +91,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define ADMF_IMMUTABLE "IMMUTABLE" #define ADMF_INCOGNITO "INCOGNITO" #define ADMF_ADMINCHAT "ADMINCHAT" +#define ADMF_HIGHADMINCHAT "HIGHADMINCHAT" #define ADMF_SEESFULLLISTPLAYERS "SEESFULLLISTPLAYERS" #define ADMF_DBUILDER "DBUILDER" #define ADMF_ADMINSTEALTH "STEALTH" diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 998cafe..1c96ede 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1028,6 +1028,10 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons ( g_scrimMode.integer != 0 && !G_admin_permission( ent, ADMF_NOSCRIMRESTRICTION ) ) ) ) return; + if( mode == SAY_HADMINS && + (!G_admin_permission( other, ADMF_HIGHADMINCHAT) || other->client->pers.ignoreAdminWarnings ) ) + return; + if( BG_ClientListTest( &other->client->sess.ignoreList, ent-g_entities ) ) ignore = qtrue; @@ -1167,6 +1171,16 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) color = COLOR_MAGENTA; } break; + + case SAY_HADMINS: + if( G_admin_permission( ent, ADMF_HIGHADMINCHAT ) ) + { + G_LogPrintf( "say_hadmins: ^7[^1HIGH ADMIN^7]%s^7: %s^7\n", ( ent ) ? ent->client->pers.netname : "console", chatText ); + Com_sprintf( name, sizeof( name ), "%s^7[^1HIGH ADMIN^7]%s%c%c"EC": ", prefix, + ( ent ) ? ent->client->pers.netname : "console", Q_COLOR_ESCAPE, COLOR_WHITE ); + color = COLOR_WHITE; + } + break; } if( mode!=SAY_TEAM && ent && ent->client && ent->client->pers.teamSelection == PTE_NONE && G_admin_level(ent)<g_minLevelToSpecMM1.integer ) @@ -1299,6 +1313,8 @@ static void Cmd_Say_f( gentity_t *ent ) mode = SAY_TEAM; if( Q_stricmpn( args, "say_admins ", 11 ) == 0 || Q_stricmpn( args, "a ", 2 ) == 0) mode = SAY_ADMINS; + if( Q_stricmpn( args, "say_hadmins ", 12 ) == 0 || Q_stricmpn( args, "ha ", 3 ) == 0) + mode = SAY_HADMINS; // support parsing /m out of say text since some people have a hard // time figuring out what the console is. @@ -1334,8 +1350,17 @@ static void Cmd_Say_f( gentity_t *ent ) ADMP( "Your message has been sent to any available admins and to the server logs.\n" ); } } - + if( ( !Q_stricmpn( args, "say /ha ", 8) || + !Q_stricmpn( args, "say_team /ha ", 13) || + !Q_stricmpn( args, "say /say_hadmins ", 17) || + !Q_stricmpn( args, "say_team /say_hadmins ", 22) ) + && G_admin_permission( ent, ADMF_HIGHADMINCHAT ) ) + { + mode = SAY_HADMINS; + skipargs=1; + } + if(!Q_stricmpn( args, "say /me ", 8 ) ) { if( g_actionPrefix.string[0] ) @@ -5340,6 +5365,8 @@ commands_t cmds[ ] = { { "say_team", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, { "say_admins", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, { "a", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, + { "say_hadmins", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, + { "ha", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, { "m", CMD_MESSAGE|CMD_INTERMISSION, G_PrivateMessage }, { "mt", CMD_MESSAGE|CMD_INTERMISSION, G_PrivateMessage }, { "me", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index c4ce182..66a7c6a 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -764,6 +764,11 @@ qboolean ConsoleCommand( void ) G_Say( NULL, NULL, SAY_ADMINS, ConcatArgs( 1 ) ); return qtrue; } + else if( !Q_stricmp( cmd, "ha" ) || !Q_stricmp( cmd, "say_hadmins" )) + { + G_Say( NULL, NULL, SAY_HADMINS, ConcatArgs( 1 ) ); + return qtrue; + } G_Printf( "unknown command: %s\n", cmd ); return qtrue; diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index ffff6dd..e7411a3 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -1337,5 +1337,6 @@ typedef enum { #define SAY_ACTION 3 #define SAY_ACTION_T 4 #define SAY_ADMINS 5 +#define SAY_HADMINS 6 #endif // __Q_SHARED_H |