diff options
author | Tony J. White <tjw@tjw.org> | 2006-10-24 20:53:29 +0000 |
---|---|---|
committer | Tony J. White <tjw@tjw.org> | 2006-10-24 20:53:29 +0000 |
commit | 6b81da2f2e7350b2bf4341a37cce86e003edca73 (patch) | |
tree | 97f7cd37537173fad1b9466deddf6219aeb24628 /src | |
parent | f9c9fc9dc2c32046dbeb8b9dbaae0fdb307ffdc4 (diff) |
* (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)
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_cmds.c | 25 |
1 files changed, 8 insertions, 17 deletions
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 ) |