From a4f55a44918811062951d1ae7ed3e706fbea34e7 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 6 Mar 2018 22:17:49 +0100 Subject: Log admin commands in games.log regardless of g_adminLog. A failure to open the admin log shouldn't affect games.log or the admin chat notifications. --- src/game/g_admin.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/game') diff --git a/src/game/g_admin.c b/src/game/g_admin.c index c46deab..61e0c1c 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -1380,9 +1380,21 @@ static void admin_log( gentity_t *admin, char *cmd, int skiparg ) int pids[ MAX_CLIENTS ]; char name[ MAX_NAME_LENGTH ]; - if( !g_adminLog.string[ 0 ] ) - return ; + if ( !Q_stricmp( cmd, "attempted" ) ) + { + Com_sprintf( string, sizeof( string ), + "%s^7 (%i) %s: %s", + ( admin ) ? admin->client->pers.netname : "console", + ( admin ) ? admin->s.clientNum : -1, + cmd, + G_SayConcatArgs( 1 + skiparg ) ); + G_AdminsPrintf("%s\n",string); + } + G_LogPrintf("Admin Command: %s^7 (%s): %s %s\n",( admin ) ? admin->client->pers.netname : "console", ( admin ) ? admin->client->pers.adminName : "console", cmd, G_SayConcatArgs( 1 + skiparg )); + + if( !g_adminLog.string[ 0 ] ) + return; len = trap_FS_FOpenFile( g_adminLog.string, &f, FS_APPEND ); if( len < 0 ) @@ -1475,19 +1487,6 @@ static void admin_log( gentity_t *admin, char *cmd, int skiparg ) trap_FS_Write( string, strlen( string ), f ); } trap_FS_FCloseFile( f ); - - if ( !Q_stricmp( cmd, "attempted" ) ) - { - Com_sprintf( string, sizeof( string ), - "%s^7 (%i) %s: %s", - ( admin ) ? admin->client->pers.netname : "console", - ( admin ) ? admin->s.clientNum : -1, - cmd, - G_SayConcatArgs( 1 + skiparg ) ); - G_AdminsPrintf("%s\n",string); - } - - G_LogPrintf("Admin Command: %s^7 (%s): %s %s\n",( admin ) ? admin->client->pers.netname : "console", ( admin ) ? admin->client->pers.adminName : "console", cmd, G_SayConcatArgs( 1 + skiparg )); } static int admin_listadmins( gentity_t *ent, int start, char *search, int minlevel ) -- cgit