From bb7bd83aaec4504b4fb90919cccaaf4d9a7b418d Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 6 May 2006 17:18:02 +0000 Subject: * Merged ioq3-r775 - SDL_GammaRamp stuff - Anisotropic texture filtering - q3testesque r_flares - cl_guid - Security fixes --- src/server/sv_ccmds.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src/server/sv_ccmds.c') diff --git a/src/server/sv_ccmds.c b/src/server/sv_ccmds.c index 55ee62fd..0e016056 100644 --- a/src/server/sv_ccmds.c +++ b/src/server/sv_ccmds.c @@ -35,12 +35,12 @@ These commands can only be entered from stdin or by a remote operator datagram /* ================== -SV_GetPlayerByName +SV_GetPlayerByHandle -Returns the player with name from Cmd_Argv(1) +Returns the player with player id or name from Cmd_Argv(1) ================== */ -static client_t *SV_GetPlayerByName( void ) { +static client_t *SV_GetPlayerByHandle( void ) { client_t *cl; int i; char *s; @@ -58,6 +58,23 @@ static client_t *SV_GetPlayerByName( void ) { s = Cmd_Argv(1); + // Check whether this is a numeric player handle + for(i = 0; s[i] >= '0' && s[i] <= '9'; i++); + + if(!s[i]) + { + int plid = atoi(s); + + // Check for numeric playerid match + if(plid >= 0 && plid < sv_maxclients->integer) + { + cl = &svs.clients[plid]; + + if(cl->state) + return cl; + } + } + // check for a name match for ( i=0, cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++ ) { if ( !cl->state ) { @@ -218,7 +235,7 @@ static void SV_MapRestart_f( void ) { delay = 5; } if( delay && !Cvar_VariableValue("g_doWarmup") ) { - sv.restartTime = svs.time + delay * 1000; + sv.restartTime = sv.time + delay * 1000; SV_SetConfigstring( CS_WARMUP, va("%i", sv.restartTime) ); return; } @@ -355,7 +372,7 @@ static void SV_Kick_f( void ) { return; } - cl = SV_GetPlayerByName(); + cl = SV_GetPlayerByHandle(); if ( !cl ) { return; } @@ -390,7 +407,7 @@ static void SV_Ban_f( void ) { return; } - cl = SV_GetPlayerByName(); + cl = SV_GetPlayerByHandle(); if (!cl) { return; @@ -675,7 +692,7 @@ static void SV_DumpUser_f( void ) { return; } - cl = SV_GetPlayerByName(); + cl = SV_GetPlayerByHandle(); if ( !cl ) { return; } -- cgit