This wiki was in read-only mode for many years, but can now be edited again. A lot of information will need to be updated.
bz_getPlayerTeam
Jump to navigation
Jump to search
bz_eTeamType bz_getPlayerTeam (int playerID)
Returns the player's team.
Parameters:
playerID - Player to lookup.
Returns:
Team the player belongs to.
Example
Display what team the player joined as a welcome message.
case bz_ePlayerJoinEvent: {
bz_PlayerJoinPartEventData_V1 *join = (bz_PlayerJoinPartEventData_V1*)eventData;
std::string teamColor = "Unknown";
if (bz_getPlayerTeam(join->playerID) == eRogueTeam)
teamColor = "rogue";
else if (bz_getPlayerTeam(join->playerID) == eRedTeam)
teamColor = "red";
else if (bz_getPlayerTeam(join->playerID) == eGreenTeam)
teamColor = "green";
else if (bz_getPlayerTeam(join->playerID) == eBlueTeam)
teamColor = "blue";
else if (bz_getPlayerTeam(join->playerID) == ePurpleTeam)
teamColor = "purple";
else if (bz_getPlayerTeam(join->playerID) == eObservers)
teamColor = "observer";
bz_sendTextMessagef(BZ_SERVER, join->playerID, "Welcome! You joined the %s team!", teamColor.c_str());
}
break;