From f6bb5ea062f5ff3d83fc9e73e20487d7f7334c04 Mon Sep 17 00:00:00 2001 From: MaeJong Date: Tue, 2 May 2017 18:36:16 +0200 Subject: Implement high admin chat The channel is accessible to anyone who has the flag HIGHADMINCHAT, via /say_hadmins or /ha --- src/game/g_admin.c | 1 + src/game/g_admin.h | 2 ++ src/game/g_cmds.c | 29 ++++++++++++++++++++++++++++- src/game/g_svcmds.c | 5 +++++ src/qcommon/q_shared.h | 1 + 5 files changed, 37 insertions(+), 1 deletion(-) 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)