summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/g_admin.c16
-rw-r--r--src/game/g_cmds.c39
2 files changed, 21 insertions, 34 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 515192b7..12ba721c 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -392,7 +392,11 @@ static void admin_writeconfig( void )
char levels[ MAX_STRING_CHARS ] = {""};
if( !g_admin.string[ 0 ] )
- return ;
+ {
+ G_Printf( S_COLOR_YELLOW "WARNING: g_admin is not set. "
+ " configuration will not be saved to a file.\n" );
+ return;
+ }
t = trap_RealTime( &qt );
len = trap_FS_FOpenFile( g_admin.string, &f, FS_WRITE );
if( len < 0 )
@@ -930,9 +934,6 @@ qboolean G_admin_cmd_check( gentity_t *ent, qboolean say )
char *cmd;
int skip = 0;
- if( g_admin.string[ 0 ] == '\0' )
- return qfalse;
-
command[ 0 ] = '\0';
G_SayArgv( 0, command, sizeof( command ) );
if( !Q_stricmp( command, "say" ) ||
@@ -1010,8 +1011,6 @@ void G_admin_namelog_update( gclient_t *client, int clientNum )
char n1[ MAX_NAME_LENGTH ];
char n2[ MAX_NAME_LENGTH ];
- if( !g_admin.string[0] )
- return;
G_SanitiseName( client->pers.netname, n1 );
for( i = 0; i < MAX_ADMIN_NAMELOGS && g_admin_namelog[ i ]; i++ )
{
@@ -1065,7 +1064,12 @@ qboolean G_admin_readconfig( gentity_t *ent, int skiparg )
char levels[ MAX_STRING_CHARS ] = {""};
if( !g_admin.string[ 0 ] )
+ {
+ ADMP( "^3!readconfig: g_admin is not set, not loading configuration "
+ "from a file\n" );
return qfalse;
+ }
+
len = trap_FS_FOpenFile( g_admin.string, &f, FS_READ ) ;
if( len < 0 )
{
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index fc5fff19..f17236d5 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -886,7 +886,7 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
G_SayTo( ent, other, mode, color, name, text );
}
- if( g_adminParseSay.integer )
+ if( g_admin.string[ 0 ] && g_adminParseSay.integer )
{
G_admin_cmd_check ( ent, qtrue );
}
@@ -1091,18 +1091,10 @@ void Cmd_CallVote_f( gentity_t *ent )
Q_strncpyz( kickee, level.clients[ clientNum ].pers.netname,
sizeof( kickee ) );
Q_CleanStr( kickee );
- if( g_admin.string[ 0 ] )
- {
- // use ip in case this player disconnects before the vote ends
- Com_sprintf( level.voteString, sizeof( level.voteString ),
- "!ban %s %d vote kick", level.clients[ clientNum ].pers.ip,
- g_adminTempBan.integer + 1 );
- }
- else
- {
- Com_sprintf( level.voteString, sizeof( level.voteString ),
- "clientkick %d", clientNum );
- }
+ // use ip in case this player disconnects before the vote ends
+ Com_sprintf( level.voteString, sizeof( level.voteString ),
+ "!ban %s %d vote kick", level.clients[ clientNum ].pers.ip,
+ g_adminTempBan.integer + 1 );
Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ),
"Kick player \'%s\'", kickee );
}
@@ -1340,20 +1332,11 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
sizeof( kickee ) );
Q_CleanStr( kickee );
- if( g_admin.string[ 0 ] )
- {
- // use ip in case this player disconnects before the vote ends
- Com_sprintf( level.teamVoteString[ cs_offset ],
- sizeof( level.teamVoteString[ cs_offset ] ),
- "!ban %s %d team vote kick", level.clients[ clientNum ].pers.ip,
- g_adminTempBan.integer + 1 );
- }
- else
- {
- Com_sprintf( level.teamVoteString[ cs_offset ],
- sizeof( level.teamVoteString[ cs_offset ] ),
- "clientkick %d", clientNum );
- }
+ // use ip in case this player disconnects before the vote ends
+ Com_sprintf( level.teamVoteString[ cs_offset ],
+ sizeof( level.teamVoteString[ cs_offset ] ),
+ "!ban %s %d team vote kick", level.clients[ clientNum ].pers.ip,
+ g_adminTempBan.integer + 1 );
Com_sprintf( level.teamVoteDisplayString[ cs_offset ],
sizeof( level.teamVoteDisplayString[ cs_offset ] ),
"Kick player \'%s\'", kickee );
@@ -2729,7 +2712,7 @@ void ClientCommand( int clientNum )
return;
}
- if( G_admin_cmd_check( ent, qfalse ) )
+ if( g_admin.string[ 0 ] && G_admin_cmd_check( ent, qfalse ) )
return;
// ignore all other commands when at intermission