예제 #1
0
bool CCSSBot :: startGame ()
{
    // do whatever is necessary here to join the game...
    IPlayerInfo* pInfo = playerinfomanager->GetPlayerInfo(m_pEdict);

    if ( pInfo->GetTeamIndex() == 0 )
    {
        pInfo->ChangeTeam(randomInt(2,3));
    }

    return (pInfo->GetTeamIndex() != 0);
}
예제 #2
0
static cell_t ChangeClientTeam(IPluginContext *pContext, const cell_t *params)
{
	int client = params[1];

	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
	if (!pPlayer)
	{
		return pContext->ThrowNativeError("Client index %d is invalid", client);
	}
	else if (!pPlayer->IsInGame())
	{
		return pContext->ThrowNativeError("Client %d is not in game", client);
	}

	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
	if (!pInfo)
	{
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
	}

	pInfo->ChangeTeam(params[2]);

	return 1;
}