- if (teamplay)
- {
- // set up
- string pl_name = playername(client.netname, client.team, false);
- int save = Player_GetForcedTeamIndex(client);
- Player_SetForcedTeamIndex(client, TEAM_FORCE_DEFAULT);
-
- // find the team to move the player to
- int team_num = Team_ColorToTeam(destination);
- entity balance;
- if (team_num == client.team) // already on the destination team
- {
- // keep the forcing undone
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is already on the ", Team_ColoredFullName(team_num), (targets ? "^7, skipping to next player.\n" : "^7."));
- continue;
- }
- else if (team_num == 0) // auto team
- {
- balance = TeamBalance_CheckAllowedTeams(client);
- team_num = Team_IndexToTeam(TeamBalance_FindBestTeam(balance, client, false));
- }
- else
- {
- balance = TeamBalance_CheckAllowedTeams(client);
- }
- Player_SetForcedTeamIndex(client, save);
+ // well technically we could, but should we allow that? :P
+ LOG_INFO("Can't change teams if the player isn't in the game.");
+ return;
+ }
+ if (!teamplay)
+ {
+ LOG_INFO("Can't change teams when currently not playing a team game.");
+ return;
+ }