diff --git a/code/server/sv_ccmds.c b/code/server/sv_ccmds.c index 29181bb6..62dd58c2 100644 --- a/code/server/sv_ccmds.c +++ b/code/server/sv_ccmds.c @@ -639,6 +639,11 @@ static void SV_RehashBans_f(void) char *textbuf, *curpos, *maskpos, *newlinepos, *endpos; char filepath[MAX_QPATH]; + // make sure server is running + if ( !com_sv_running->integer ) { + return; + } + serverBansCount = 0; if(!sv_banFile->string || !*sv_banFile->string) @@ -709,7 +714,7 @@ static void SV_RehashBans_f(void) /* ================== -SV_WriteBans_f +SV_WriteBans Save bans to file. ================== @@ -826,7 +831,13 @@ static void SV_AddBanToList(qboolean isexception) netadr_t ip; int index, argc, mask; serverBan_t *curban; - + + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + argc = Cmd_Argc(); if(argc < 2 || argc > 3) @@ -858,11 +869,6 @@ static void SV_AddBanToList(qboolean isexception) client_t *cl; // client num. - if(!com_sv_running->integer) - { - Com_Printf("Server is not running.\n"); - return; - } cl = SV_GetPlayerByNum(); @@ -968,6 +974,12 @@ static void SV_DelBanFromList(qboolean isexception) netadr_t ip; char *banstring; + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + if(Cmd_Argc() != 2) { Com_Printf ("Usage: %s (ip[/subnet] | num)\n", Cmd_Argv(0)); @@ -1052,6 +1064,12 @@ static void SV_ListBans_f(void) { int index, count; serverBan_t *ban; + + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } // List all bans for(index = count = 0; index < serverBansCount; index++) @@ -1089,6 +1107,12 @@ Delete all bans and exceptions. static void SV_FlushBans_f(void) { + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + serverBansCount = 0; // empty the ban file. @@ -1285,6 +1309,12 @@ Examine the serverinfo string =========== */ static void SV_Serverinfo_f( void ) { + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + Com_Printf ("Server info settings:\n"); Info_Print ( Cvar_InfoString( CVAR_SERVERINFO ) ); } @@ -1294,10 +1324,16 @@ static void SV_Serverinfo_f( void ) { =========== SV_Systeminfo_f -Examine or change the serverinfo string +Examine the systeminfo string =========== */ static void SV_Systeminfo_f( void ) { + // make sure server is running + if ( !com_sv_running->integer ) { + Com_Printf( "Server is not running.\n" ); + return; + } + Com_Printf ("System info settings:\n"); Info_Print ( Cvar_InfoString_Big( CVAR_SYSTEMINFO ) ); }