private static void ChangeTeam(Player player) { if (player.Team == BasePlayer.NoTeam) { player.SendClientMessage(Color.Red, "Error: Usted no pertenece a ningún equipo."); return; } TeamAlpha.GetMessageTeamEnable(out var msgAlpha, false); TeamBeta.GetMessageTeamEnable(out var msgBeta, false); var ct = new TablistDialog("Change Team", new[] { "Name", "Users", "Availability" }, "Seleccionar", "Cerrar"); ct.ShowDialog(player); ct.Response += (sender, e) => { if (e.DialogButton == DialogButton.Left) { if (player.PlayerTeam.Id == (TeamID)e.ListItem) { player.SendClientMessage(Color.Red, "Error: Ya formas parte de ese equipo."); ct.ShowDialog(player); return; } if (TeamAlpha.Members == TeamBeta.Members) { player.SendClientMessage(Color.Red, $"Error: No puedes cambiarte al equipo {(e.ListItem == 0 ? "Alpha" : "Beta")} porque el equipo {player.PlayerTeam.NameTeam} quedaría desequilibrado."); ct.ShowDialog(player); return; } if (player.PlayerTeam.TeamRival.IsFull()) { player.SendClientMessage(Color.Red, "Error: El equipo no está disponible."); ct.ShowDialog(player); return; } if (player.IsCapturedFlag()) { player.Drop(); } Player.Remove(player); player.PlayerTeam = (e.ListItem == 0) ? TeamAlpha : TeamBeta; Player.Add(player); BasePlayer.SendClientMessageToAll($"{player.PlayerTeam.OtherColor}[Team {player.PlayerTeam.NameTeam}]: {player.Name} se cambió al equipo {player.PlayerTeam.NameTeam}."); TextDrawGlobal.UpdateCountUsers(); player.Spawn(); } }; }