d chat für admins
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user