Skip to content

Commit

Permalink
Change more operator commands to require sv_running to be usable. Pat…
Browse files Browse the repository at this point in the history
…ch by Ensiform.
  • Loading branch information
zturtleman committed Nov 1, 2012
1 parent 262e8e9 commit 8234225
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions code/server/sv_ccmds.c
Expand Up @@ -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)
Expand Down Expand Up @@ -709,7 +714,7 @@ static void SV_RehashBans_f(void)

/*
==================
SV_WriteBans_f
SV_WriteBans
Save bans to file.
==================
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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++)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 ) );
}
Expand All @@ -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 ) );
}
Expand Down

0 comments on commit 8234225

Please sign in to comment.