void _CheckScrambleVote (void) { int i, numvotes, playernum, team; float votes; edict_t *ent, *other; char buf[128]; _CalcScrambleVotes(&playernum, &numvotes, &votes); if (numvotes > 0) { sprintf (buf, "Scramble: %d votes (%.1f%%), need %.1f%%\n", numvotes, votes, scramblevote_pass->value); gi.bprintf (PRINT_HIGH, strtostr2 (buf)); } if (playernum < scramblevote_min->value) return; if (numvotes < scramblevote_need->value) return; if (votes < scramblevote_pass->value) return; MakeAllLivePlayersObservers (); for (i = 1; i <= game.maxclients; i++) { ent = &g_edicts[i]; if (ent->client && ent->inuse && ent->client->resp.team != NOTEAM) { other = _RandomTeamPlayer(); if(other != NULL && rand() % 2) { team = other->client->resp.team; other->client->resp.team = ent->client->resp.team; ent->client->resp.team = team; ent->client->resp.scramblevote = false; } } } CenterPrintAll("The teams have been scrambled!"); }
void _CheckScrambleVote (void) { int numvotes = 0, playernum = 0; float votes = 0.0f; char buf[128]; _CalcScrambleVotes(&playernum, &numvotes, &votes); if (numvotes > 0) { Com_sprintf(buf, sizeof(buf), "Scramble: %d votes (%.1f%%), need %.1f%%", numvotes, votes, scramblevote_pass->value); G_HighlightStr(buf, buf, sizeof(buf)); gi.bprintf(PRINT_HIGH, "%s\n", buf); } if (playernum < scramblevote_min->value) return; if (numvotes < scramblevote_need->value) return; if (votes < scramblevote_pass->value) return; ScrambleTeams(); }