fix error

This commit is contained in:
hydrant
2019-05-26 17:47:35 +02:00
parent e616e6af1f
commit cc8544b76c
4 changed files with 14 additions and 10 deletions

View File

@@ -133,7 +133,7 @@ namespace ReallifeGamemode.Server.Commands
message = Regex.Replace(message, "#([0-9A-Fa-f]{6})", m => "!{" + m.Groups[0].Value + "}"); message = Regex.Replace(message, "#([0-9A-Fa-f]{6})", m => "!{" + m.Groups[0].Value + "}");
string publicMessage = "~b~(( " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + message + " ~b~))"; string publicMessage = "~b~(( " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + message + " ~b~))";
NAPI.Chat.SendChatMessageToAll(publicMessage); ChatService.Broadcast(publicMessage);
} }
[Command("team", "~m~Benutzung: ~s~/team")] [Command("team", "~m~Benutzung: ~s~/team")]
@@ -246,7 +246,7 @@ namespace ReallifeGamemode.Server.Commands
ChatService.SendMessage(player, "~y~PM an " + target.Name + ": " + msg + " "); ChatService.SendMessage(player, "~y~PM an " + target.Name + ": " + msg + " ");
string Message = "~y~PM von " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + msg + ""; string Message = "~y~PM von " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + msg + "";
NAPI.Chat.SendChatMessageToPlayer(target, Message); ChatService.SendMessage(target, Message);
} }
[Command("factionlist", "~m~Benutzung: ~s~/factionlist")] [Command("factionlist", "~m~Benutzung: ~s~/factionlist")]
@@ -420,7 +420,7 @@ namespace ReallifeGamemode.Server.Commands
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
NAPI.Chat.SendChatMessageToAll(""); ChatService.Broadcast("");
} }
} }
@@ -575,9 +575,9 @@ namespace ReallifeGamemode.Server.Commands
string targetPlayername = NAPI.Player.GetPlayerName(target); string targetPlayername = NAPI.Player.GetPlayerName(target);
string adminPlayername = NAPI.Player.GetPlayerName(player); string adminPlayername = NAPI.Player.GetPlayerName(player);
NAPI.Chat.SendChatMessageToPlayer(target, "~r~KICKINFO: ~w~Du wurdest von " + adminPlayername + " vom Server gekickt: " + reason); ChatService.SendMessage(target, "~r~KICKINFO: ~w~Du wurdest von " + adminPlayername + " vom Server gekickt: " + reason);
target.Kick(); target.Kick();
NAPI.Chat.SendChatMessageToAll("~y~INFO: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason); ChatService.Broadcast("~y~INFO: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason);
} }
[Command("ip", "~m~Benutzung: ~s~/ip [Spieler]")] [Command("ip", "~m~Benutzung: ~s~/ip [Spieler]")]
@@ -2093,12 +2093,12 @@ namespace ReallifeGamemode.Server.Commands
if (!weatherBefore.Equals(weatherAfter)) if (!weatherBefore.Equals(weatherAfter))
{ {
NAPI.Chat.SendChatMessageToPlayer(player, "~w~Wetter geändert: " + NAPI.World.GetWeather()); ChatService.SendMessage(player, "~w~Wetter geändert: " + NAPI.World.GetWeather());
NAPI.Notification.SendNotificationToAll("Das Wetter wurde auf ~g~ " + NAPI.World.GetWeather() + "~s~ geändert.", true); NAPI.Notification.SendNotificationToAll("Das Wetter wurde auf ~g~ " + NAPI.World.GetWeather() + "~s~ geändert.", true);
} }
else else
{ {
NAPI.Chat.SendChatMessageToPlayer(player, "~w~Das Wetter konnte nicht geändert werden"); ChatService.SendMessage(player, "~w~Das Wetter konnte nicht geändert werden");
} }
} }

View File

@@ -1,5 +1,6 @@
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Models;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -97,7 +98,7 @@ namespace ReallifeGamemode.Server.Entities
if (mins == 0) if (mins == 0)
{ {
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " permanent gebannt. [" + reason + "]"); ChatService.Broadcast("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " permanent gebannt. [" + reason + "]");
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp }; banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp };
this.Client?.Kick(); this.Client?.Kick();
@@ -106,7 +107,7 @@ namespace ReallifeGamemode.Server.Entities
} }
else else
{ {
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " für " + mins + " Minuten gebannt. [" + reason + "]"); ChatService.Broadcast("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " für " + mins + " Minuten gebannt. [" + reason + "]");
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp + mins * 60 }; banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp + mins * 60 };
this.Client?.Kick(); this.Client?.Kick();
} }

View File

@@ -44,7 +44,7 @@ namespace ReallifeGamemode.Server.Events
//player.TriggerEvent("medicInfo", dutyMedics); //player.TriggerEvent("medicInfo", dutyMedics);
//TODO: Zum Full Release entfernen //TODO: Zum Full Release entfernen
NAPI.Chat.SendChatMessageToPlayer(player, "Du bist durch " + killer.Name + " gestorben: " + reason.ToString()); ChatService.SendMessage(player, "Du bist durch " + killer.Name + " gestorben: " + reason.ToString());
int? killerId; int? killerId;
float killerPosX; float killerPosX;

View File

@@ -4,6 +4,7 @@ using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Job; using ReallifeGamemode.Server.Job;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
/** /**
* @overview Life of German Reallife - Chat Service (ChatService.cs) * @overview Life of German Reallife - Chat Service (ChatService.cs)
@@ -36,6 +37,8 @@ namespace ReallifeGamemode.Server.Services
player.SendChatMessage(message); player.SendChatMessage(message);
} }
public static void Broadcast(string message) => NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn()).ToList().ForEach(c => SendMessage(c, message));
/// <summary> /// <summary>
/// Sendet eine Nachricht an eine Liste von Fraktionen /// Sendet eine Nachricht an eine Liste von Fraktionen
/// </summary> /// </summary>