View Single Post
Re: Problem with RealBot and CSBot:
Old
  (#11)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Problem with RealBot and CSBot: - 05-10-2004

another way would be to catch "TeamInfo" messages..
except they are unreliable because the time they are sent is when someone joins but when that someone barely joins he has no team and it won't send another TeamInfo message until the next time someone joins..
each time someone joins it gets sent for all the players to refresh their team or something..
this is statsme's implementation of catching these messages.. from v2.7 but also used in v2.8
PHP Code:
// team is changed then this msg is send
void Client_TeamInfo_CS(voidmValue)
{    
    if (
mPlayer) return;

    static 
int index;

    switch (
mState++) {
    case 
0:
        
index = *(int*)mValue;
        break;
    case 
1:
        const 
charteam = (char*)mValue;

        
int i;
        
        for(
0sm.team_num ; ++i)
            if ( !
strcmpi(sm.team_name[i],team) ) 
                break;

        
//accept only new teams, max. 4 teams
        
if ( == sm.team_num && )
            
strcpysm.team_name[sm.team_num++], team);

        
player_t*pPlayer GET_PLAYER_POINTER_Iindex );

        if ( !
pPlayer->ingame ) {//this is bot...
            
edict_tpEntity INDEXENT(index);
            
PlayerConnectpEntity STRING(pEntity->v.netname), "127.0.0.1:27005" );
            
PlayerPutInServerpPlayer );
        }

        
strcpy(pPlayer->team_namesm.team_name[i]); //save name of team
        
pPlayer->team_index i;
        
sm.team_players[0] = 0;
        
sm.team_players[1] = 0;
        
sm.team_players[2] = 0;
        
sm.team_players[3] = 0;
        for ( 
1<= gpGlobals->maxClients; ++)
        {
            
pPlayer GET_PLAYER_POINTER_I);
            
sm.team_players[pPlayer->team_index]++;
        }
    }

  
Reply With Quote