Skip to content

Commit

Permalink
Don't write error message in chat if players try to join the team the…
Browse files Browse the repository at this point in the history
…y are force into
  • Loading branch information
JensForstmann committed Oct 12, 2024
1 parent 0bf0a8b commit f5499b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/src/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,11 +834,13 @@ export const sayWhatTeamToJoin = async (match: Match) => {
const onTeamCommand: commands.CommandHandler = async ({ match, player, parameters }) => {
const firstParameter = parameters[0]?.toUpperCase();
if (firstParameter === 'A' || firstParameter === 'B') {
if (Player.getForcedTeam(match, player.steamId64)) {
const forcedTeam = Player.getForcedTeam(match, player.steamId64);
const wantedTeam: TTeamAB = firstParameter === 'A' ? 'TEAM_A' : 'TEAM_B';
if (forcedTeam && forcedTeam !== wantedTeam) {
await say(match, `PLAYER ${escapeRconString(player.name)} CANNOT CHANGE THEIR TEAM`);
return;
}
player.team = firstParameter === 'A' ? 'TEAM_A' : 'TEAM_B';
player.team = wantedTeam;
MatchService.scheduleSave(match);
const team = getTeamByAB(match, player.team);
await say(
Expand Down

0 comments on commit f5499b9

Please sign in to comment.