From 6b81da2f2e7350b2bf4341a37cce86e003edca73 Mon Sep 17 00:00:00 2001 From: "Tony J. White" Date: Tue, 24 Oct 2006 20:53:29 +0000 Subject: * (bug 2860) use proper team check in teamvote teamclientckick and also check to make sure the id provided isn't higher than the max client number (Martin Doucha) --- src/game/g_cmds.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'src/game/g_cmds.c') diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 4adc1187..1a990af5 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1060,9 +1060,10 @@ void Cmd_CallVote_f( gentity_t *ent ) } } + if( clientNum > -1 ) + clientNum = atoi( arg2 ); if( clientNum >= 0 && clientNum < level.maxclients ) { - clientNum = atoi( arg2 ); if( G_admin_permission( &g_entities[ clientNum ], ADMF_IMMUNITY ) ) { trap_SendServerCommand( ent-g_entities, @@ -1288,24 +1289,14 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) } } + if( clientNum > -1 ) + clientNum = atoi( arg2 ); if( clientNum >= 0 && clientNum < level.maxclients ) { - clientNum = atoi( arg2 ); - - for( i = 0; i < level.maxclients; i++ ) - { - if( level.clients[ i ].pers.connected == CON_DISCONNECTED ) - continue; - - if( level.clients[ i ].ps.stats[ STAT_PTEAM ] != team ) - continue; - - if( level.clients[ i ].ps.clientNum == clientNum ) - break; - } - - if( i >= level.maxclients ) - clientNum = -1; + if( level.clients[ clientNum ].pers.connected == CON_DISCONNECTED ) + clientNum = -1; + else if( level.clients[ clientNum ].pers.teamSelection != team ) + clientNum = -1; } if( clientNum < 0 ) -- cgit