View Single Post
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#5)
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: not correct detection by bots chicken as a friend/enemy - 23-04-2005

right now I only see one way of fixing this. I was looking through StatsMe code and I found this.
Code:
void Client_TeamInfo(void* mValue)
{	
	if (mPlayer) return;

	static int index;

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

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

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

		player_t*pPlayer = GET_PLAYER_POINTER_I( index );

		if ( !pPlayer->ingame && !strcmpi(GETPLAYERAUTHID(INDEXENT(index)),"BOT")) //this is bot...
		{
			edict_t* pEntity = INDEXENT(index);
			PlayerConnect( pEntity , STRING(pEntity->v.netname), "127.0.0.1:27005" );
			PlayerPutInServer( pPlayer );
		}

		strcpy(pPlayer->team_name, sm.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 ( i = 1; i <= gpGlobals->maxClients; ++i )
		{
			pPlayer = GET_PLAYER_POINTER_I( i );
			sm.team_players[pPlayer->team_index]++;
		}
	}
}
This function is the function that processes the "TeamInfo" message

I tried using this before but it seems unreliable, but statsme seems to be able to use it just fine. For me, the "TeamInfo" message seems to be sent only when people connect to the server. Each time someone connects to the server, it sends the TeamInfo message for each player in the server. But those people that just connected haven't chosen a team yet so they are in team "unknown". The first part of the message is an integer for the team index and the second part is a string of the team name. Appearantly Statsme uses this message for multiple mods.
  
Reply With Quote