View Single Post
Re: How to integrate bot in to the game dll ?
Old
  (#9)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: How to integrate bot in to the game dll ? - 09-07-2005

I need by some help. So I have problems with getting the bot to join in game.
Here my code placed in the start of BotThink()
Code:
if (not_started)
	{
		for (int index = 1; index < gpGlobals->maxClients; index++)
		{
			CBasePlayer *pPlayer;

			pPlayer = (CBasePlayer*)UTIL_PlayerByIndex( index );

			if (!pPlayer)  // if invalid then continue with next index...
				continue;

			if (IsAlive())
				continue;

			if ((create_time + 0.5 <= gpGlobals->time) && (pPlayer->pev->flags & FL_FAKECLIENT))
			{
			    pPlayer->m_iTeam = 1;// Join Team 1
				pPlayer->m_iNextTeam = 1;
			    pPlayer->m_iClass = 1;// Select class 1
				pPlayer->m_iNextClass = 1;
				pPlayer->Spawn();// Spawn the bot
				not_started = 0;
				create_time = gpGlobals->time;

			    g_engfuncs.pfnRunPlayerMove( edict( ), pev->v_angle, f_move_speed,
											 0, 0, pev->button, 0,
											 gpGlobals->frametime * 1000 );
				return;
			}
		}
	}
So after all only the first bot join in game. After I type add bot again the others bots stay spectators. If you can tell me where is the my mistake.
not_started is settet to 1 when new bot connect.
Btw I'm using bot10 by botman for integrating the bot in to the sow.dll file.
  
Reply With Quote