/tog d & ga
This commit is contained in:
@@ -240,6 +240,29 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SendNotification("~g~[Info]~w~ Connect-Logs werden nun angezeigt.");
|
||||
}
|
||||
break;
|
||||
case "d":
|
||||
if (player.HasData("togd"))
|
||||
{
|
||||
player.ResetData("togd");
|
||||
player.SendNotification("~g~[Info]~w~ D-Chat wird nun ausgeblendet.");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetData("togd", true);
|
||||
player.SendNotification("~g~[Info]~w~ D-Chat wird nun angezeigt.");
|
||||
}
|
||||
case "ga":
|
||||
if (player.HasData("togga"))
|
||||
{
|
||||
player.ResetData("togga");
|
||||
player.SendNotification("~g~[Info]~w~ GA-Chat wird nun ausgeblendet.");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetData("togga", true);
|
||||
player.SendNotification("~g~[Info]~w~ GA-Chat wird nun angezeigt.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
User user = player.GetUser(dbContext);
|
||||
Faction f = user?.Faction;
|
||||
if ((f == null || !f.GangOwned) && !user.IsAdmin(AdminLevel.ADMIN))
|
||||
if ((f == null || !f.GangOwned) && !user.IsAdmin(AdminLevel.ADMIN) && !player.HasData("togga"))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -105,7 +105,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
string broadcastMessage = "!{FF0000}** " + rank + " " + player.Name + ": " + message + " **";
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true);
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true, (admin) => admin.HasData("togga"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
User user = player.GetUser(dbContext);
|
||||
Faction f = user?.Faction;
|
||||
if ((f == null || !f.StateOwned) && !user.IsAdmin(AdminLevel.ADMIN))
|
||||
if ((f == null || !f.StateOwned) && !user.IsAdmin(AdminLevel.ADMIN) && !player.HasData("todg"))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -185,7 +185,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
string broadcastMessage = "!{CC3333}** " + factionName + " " + player.Name + ": " + message + ", over **";
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned), true);
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned), true, (admin) => admin.HasData("togd"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace ReallifeGamemode.Server.Services
|
||||
/// </summary>
|
||||
/// <param name="message">Die Nachricht, die gesendet werden soll</param>
|
||||
/// <param name="factions">Die Liste an Fraktionen, die diese Nachricht bekommen sollen</param>
|
||||
public static void BroadcastFaction(string message, List<Faction> factions, bool toAdmins = false)
|
||||
public static void BroadcastFaction(string message, List<Faction> factions, bool toAdmins = false, Predicate<Player> shouldSendToAdmins = null)
|
||||
{
|
||||
foreach (Player c in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace ReallifeGamemode.Server.Services
|
||||
{
|
||||
ChatService.SendMessage(c, message);
|
||||
}
|
||||
else if (user.IsAdmin(AdminLevel.ADMIN) && toAdmins)
|
||||
else if (user.IsAdmin(AdminLevel.ADMIN) && (toAdmins && (shouldSendToAdmins == null || shouldSendToAdmins(c))))
|
||||
{
|
||||
ChatService.SendMessage(c, message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user