edict_t *CPluginBotManager::CreateBot( const char *botname ) { edict_t *pEdict = engine->CreateFakeClient( botname ); if (!pEdict) { Msg( "Failed to create Bot.\n"); return NULL; } // Allocate a player entity for the bot, and call spawn CBasePlayer *pPlayer = ((CBasePlayer*)CBaseEntity::Instance( pEdict )); pPlayer->ClearFlags(); pPlayer->AddFlag( FL_CLIENT | FL_FAKECLIENT ); pPlayer->ChangeTeam( TEAM_UNASSIGNED ); pPlayer->AddEFlags( EFL_PLUGIN_BASED_BOT ); // Mark it as a plugin based bot pPlayer->RemoveAllItems( true ); pPlayer->Spawn(); return pEdict; }