summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-10-03 12:32:29 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:03 +0000
commit75aea75974336cc763d936aac735eb8c110e2cb7 (patch)
tree2ff8be362565911109a9fe2c4137c156589c6864 /src
parent55f9653842686fb1c56e168e1fe183982138f56f (diff)
* (bug 3354) Add /clientlist cgame command for listing connected clients (DevHC)
* Remove ADMF_SEESFULLLISTPLAYERS and return !listplayers to the old default value of always listing everything. Servers can now freely disallow !listplayers from non-admins, who can use /clientlist (or the GUI) to obtain the info they need.
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_consolecmds.c36
-rw-r--r--src/game/g_admin.c43
-rw-r--r--src/game/g_admin.h1
3 files changed, 51 insertions, 29 deletions
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c
index e1354f37..4b408cf1 100644
--- a/src/cgame/cg_consolecmds.c
+++ b/src/cgame/cg_consolecmds.c
@@ -173,6 +173,41 @@ static void CG_TellAttacker_f( void )
trap_SendClientCommand( command );
}
+void CG_ClientList_f( void )
+{
+ clientInfo_t *ci;
+ int i;
+ int count = 0;
+
+ for( i = 0; i < MAX_CLIENTS; i++ )
+ {
+ ci = &cgs.clientinfo[ i ];
+ if( !ci->infoValid )
+ continue;
+
+ switch( ci->team )
+ {
+ case TEAM_ALIENS:
+ Com_Printf( "%2d ^1A ^7%s^7\n", i, ci->name );
+ break;
+
+ case TEAM_HUMANS:
+ Com_Printf( "%2d ^4H ^7%s^7\n", i, ci->name );
+ break;
+
+ default:
+ case TEAM_NONE:
+ case NUM_TEAMS:
+ Com_Printf( "%2d ^3S ^7%s^7\n", i, ci->name );
+ break;
+ }
+
+ count++;
+ }
+
+ Com_Printf( "Listed %2d clients\n", count );
+}
+
static void CG_UIMenu_f( void )
{
trap_SendConsoleCommand( va( "menu %s\n", CG_Argv( 1 ) ) );
@@ -203,6 +238,7 @@ static consoleCommand_t commands[ ] =
{ "destroyTestPS", CG_DestroyTestPS_f },
{ "testTS", CG_TestTS_f },
{ "destroyTestTS", CG_DestroyTestTS_f },
+ { "clientlist", CG_ClientList_f },
};
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index d6a1ecb5..ef523361 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -555,11 +555,11 @@ static void admin_default_levels( void )
Q_strncpyz( g_admin_levels[ 3 ]->name, "^2Junior Admin",
sizeof( l->name ) );
- Q_strncpyz( g_admin_levels[ 3 ]->flags, "iahCpPkm$?", sizeof( l->flags ) );
+ Q_strncpyz( g_admin_levels[ 3 ]->flags, "iahCpPkm?", sizeof( l->flags ) );
Q_strncpyz( g_admin_levels[ 4 ]->name, "^3Senior Admin",
sizeof( l->name ) );
- Q_strncpyz( g_admin_levels[ 4 ]->flags, "iahCpPkmBbe$?", sizeof( l->flags ) );
+ Q_strncpyz( g_admin_levels[ 4 ]->flags, "iahCpPkmBbe?", sizeof( l->flags ) );
Q_strncpyz( g_admin_levels[ 5 ]->name, "^1Server Operator",
sizeof( l->name ) );
@@ -2356,32 +2356,19 @@ qboolean G_admin_listplayers( gentity_t *ent, int skiparg )
}
}
- if( G_admin_permission( ent, ADMF_SEESFULLLISTPLAYERS ) )
- {
- ADMBP( va( "%2i %s%s^7 %-2i %s^7 (*%s) ^1%1s%1s^7 %s^7 %s%s^7%s\n",
- i,
- c,
- t,
- l,
- lname,
- guid_stub,
- muted,
- denied,
- p->pers.netname,
- ( *n ) ? "(a.k.a. " : "",
- n,
- ( *n ) ? ")" : "" ) );
- }
- else
- {
- ADMBP( va( "%2i %s%s^7 ^1%1s%1s^7 %s^7\n",
- i,
- c,
- t,
- muted,
- denied,
- p->pers.netname ) );
- }
+ ADMBP( va( "%2i %s%s^7 %-2i %s^7 (*%s) ^1%1s%1s^7 %s^7 %s%s^7%s\n",
+ i,
+ c,
+ t,
+ l,
+ lname,
+ guid_stub,
+ muted,
+ denied,
+ p->pers.netname,
+ ( *n ) ? "(a.k.a. " : "",
+ n,
+ ( *n ) ? ")" : "" ) );
}
ADMBP_end();
return qtrue;
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index 3eada800..494496dc 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -69,7 +69,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define ADMF_IMMUTABLE '!'
#define ADMF_INCOGNITO '@'
-#define ADMF_SEESFULLLISTPLAYERS '$'
#define ADMF_ADMINCHAT '?'
#define MAX_ADMIN_LISTITEMS 20