09-17-2007, 11:12 PM
Alright, forgetting what I've said above, here is the complete fix with the changes in bold. All of these functions are in disc_arena.cpp.
Quote:void CDiscArena::Reset( void )
{
// Remove all clients in the queue
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i );
if (pPlayer && (pPlayer->m_pCurrentArena == this) && pPlayer->m_bHasDisconnected != TRUE && (stricmp(GETPLAYERAUTHID(pPlayer->edict()), "HLTV") != 0))
{
RemoveClient( pPlayer );
// Move her into spectator mode
//MoveToSpectator( pPlayer );
}
}
m_pPlayerQueue = NULL;
m_iPlayers = 0;
m_flTimeLimitOver = 0;
m_bShownTimeWarning = FALSE;
m_iArenaState = ARENA_WAITING_FOR_PLAYERS;
memset( m_hCombatants, 0, sizeof( m_hCombatants ) );
SetThink( NULL );
pev->nextthink = 0;
}<!--/sizec-->
Quote:void AddClientToArena( CBasePlayer *pPlayer )
{
if (stricmp(GETPLAYERAUTHID(pPlayer->edict()), "HLTV") == 0)
{
return;
}
// First, find an arena for this player to be put into
for (int i = 0; i < MAX_ARENAS; i++)
{
if ( g_pArenaList[i]->IsFull() == FALSE )
{
int iArenaNumber = i;
g_pArenaList[iArenaNumber]->AddClient( pPlayer, TRUE );
bool bFoundOne = TRUE;
// Now, if this arena's not full, try to find more player to join her
//Commented out - .asm 06/03/03
/* while ( (g_pArenaList[iArenaNumber]->IsFull() == FALSE) && bFoundOne )
{
bFoundOne = FALSE;
// Cycle through all the arenas and find a spare player
for (int j = 0; j < MAX_ARENAS; j++)
{
CBasePlayer *pSparePlayer = g_pArenaList[j]->GetFirstSparePlayer();
if (pSparePlayer && pSparePlayer != pPlayer)
{
g_pArenaList[j]->RemoveClient( pSparePlayer );
g_pArenaList[iArenaNumber]->AddClient( pSparePlayer, TRUE );
bFoundOne = TRUE;
break;
}
}
} */
// If we couldn't find another player for this arena, just add them to an existing arena
if ( g_pArenaList[iArenaNumber]->IsFull() == FALSE )
{
// Add to the first full arena
for (int j = 0; j < MAX_ARENAS; j++)
{
if ( g_pArenaList[j]->IsFull() )
{
// Remove from current
g_pArenaList[iArenaNumber]->RemoveClient( pPlayer );
// Add to full one
iArenaNumber = j;
g_pArenaList[iArenaNumber]->AddClient( pPlayer, TRUE );
break;
}
}
}
//Beginning of added code to prevent reconnectors - .asm 06/03/03
else
{
bFoundOne = FALSE;
// Cycle through all the arenas and find a spare player
for (int j = 0; j < MAX_ARENAS; j++)
{
CBasePlayer *pSparePlayer = g_pArenaList[j]->GetFirstSparePlayer();
if (pSparePlayer && pSparePlayer != pPlayer)
{
g_pArenaList[j]->RemoveClient( pSparePlayer );
g_pArenaList[iArenaNumber]->AddClient( pSparePlayer, TRUE );
bFoundOne = TRUE;
break;
}
}
}
//End of added code to prevent reconnectors - .asm 06/03/03
//ALERT( at_console, "ADDED %s to Arena %d\n", STRING(pPlayer->pev->netname), iArenaNumber );
return;
}
}
}<!--/sizec-->
Quote:int AddPlayers( int iPlayers, int iArenaNum )
{
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i );
if (pPlayer && (pPlayer->m_pCurrentArena == NULL) && (pPlayer->m_bHasDisconnected != TRUE) && (stricmp(GETPLAYERAUTHID(pPlayer->edict()), "HLTV") != 0))
{
if ( pPlayer->m_iLastGameResult != iPlayers )
continue;
g_pArenaList[iArenaNum]->AddClient( pPlayer, FALSE );
if ( g_pArenaList[iArenaNum]->IsFull() )
iArenaNum++;
}
}
return iArenaNum;
}<!--sizec--><!--/sizec-->