diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index b7e32058..8cebc338 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -97,8 +97,9 @@ namespace ReallifeGamemode.Server.Commands [Command("d", "~m~Benutzung: ~s~/d [Nachricht]", GreedyArg = true)] public void CmdFactionD(Player player, string message) { + User u = player.GetUser(); Faction f = player.GetUser()?.Faction; - if (f == null || !f.StateOwned) + if ((f == null || !f.StateOwned) && !u.IsAdmin(AdminLevel.ADMIN)) { ChatService.NotAuthorized(player); return; @@ -106,10 +107,21 @@ namespace ReallifeGamemode.Server.Commands message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", ""); - string broadcastMessage = "!{CC3333}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **"; + string factionName = string.Empty; + + if(f.StateOwned) + { + factionName = player.GetUser().GetFactionRank().RankName; + } + else + { + factionName = "[ADMIN]"; + } + + string broadcastMessage = "!{CC3333}** " + factionName + " " + player.Name + ": " + message + ", over **"; using (var context = new DatabaseContext()) { - ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned)); + ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned), true); } }