Code: Select all
if (RedTimeElapsed >= TimeLimit) {
bzAPIIntList *playerList = bz_newIntList();
bz_getPlayerIndexList ( playerList );
for ( unsigned int i = 0; i < playerList->size(); i++ ){
bz_PlayerRecord *player = bz_getPlayerByIndex(i);
if (player){
if (player->team == eRedTeam)
bz_killPlayer(player->playerID, true, BZ_SERVER);
}
bz_freePlayerRecord(player);
}
bz_deleteIntList(playerList);
RedLastTime = bz_getCurrentTime ();
RedLastWarn = bz_getCurrentTime ();
bz_sendTextMessagef (BZ_SERVER, BZ_ALLUSERS, "Red team did not capture any other team flags in time.");
AdjTime = (int)(TimeLimit / 60 + 0.5);
bz_sendTextMessagef (BZ_SERVER, eRedTeam, "CTF timer is reset to %i minutes for the red team.", AdjTime);
}
Does anyone know a work-around for a null player record and how I might identify this player for a mass team kill?