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 gameOver
Jump to navigation
Jump to search
void bz_gameOver() (int playerID, bz_eTeamType team)
Creates a Game Over, announcing the players and/or team(s) specified as the winner.
Parameters:
playerID - The player ID for the player that won the game.
team - The team that wins the game, regardless of the player ID. By default this value is 0, which makes the team of the player playerID was specified for as the winner. If set to a bz_eTeamType type, it will announce that the specified color team won even if the player specified by playerID is on a different team.
Example
This will pick a random player currently playing and say that they won the game.
bz_APIIntList *playerList = bz_newIntList();
bool picked=false;
bz_getPlayerIndexList(playerList);
while ( !picked && (bz_getTeamCount(eRogueTeam)+
bz_getTeamCount(eRedTeam)+
bz_getTeamCount(eGreenTeam)+
bz_getTeamCount(eBlueTeam)+
bz_getTeamCount(ePurpleTeam)+
bz_getTeamCount(eHunterTeam)+
bz_getTeamCount(eRabbitTeam))) {
for (int i=0;i<playerList->size();i++) {
if (((rand()%playerList->size())==0) && bz_getPlayerTeam(i)!=eObservers) {
bz_gameOver(i);
picked=true;
break;
}
}
}
bz_deleteIntList(playerList);