Esempio n. 1
0
// Return the number of bots following the given player
int GetBotFollowCount(CBasePlayer *pLeader)
{
	int count = 0;
	for (int i = 1; i <= gpGlobals->maxClients; i++)
	{
		CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);

		if (!pPlayer)
			continue;

		if (FNullEnt(pPlayer->pev))
			continue;

		if (FStrEq(STRING(pPlayer->pev->netname), ""))
			continue;

		if (!pPlayer->IsBot())
			continue;

 		if (!pPlayer->IsAlive())
 			continue;

		CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
		if (pBot->IsBot() && pBot->GetFollowLeader() == pLeader)
			count++;
	}

	return count;
}
Esempio n. 2
0
int GetBotFollowCount(CBasePlayer *leader)
{
	int count = 0;

	for (int i = 1; i <= gpGlobals->maxClients; ++i)
	{
		CBaseEntity *entity = UTIL_PlayerByIndex(i);

		if (entity == NULL)
			continue;

		if (FNullEnt(entity->pev))
			continue;

		if (FStrEq(STRING(entity->pev->netname), ""))
			continue;

		CBasePlayer *player = static_cast<CBasePlayer *>(entity);

		if (!player->IsBot())
			continue;

 		if (!player->IsAlive())
 			continue;

		CCSBot *bot = dynamic_cast<CCSBot *>(player);
		if (bot != NULL && bot->GetFollowLeader() == leader)
			++count;
	}

	return count;
}