diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index 204c681f..ea639b91 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; @@ -90,6 +91,30 @@ namespace ReallifeGamemode.Server.Commands player.SendNotification("Du hast dich zum Event teleportiert"); } + [Command("sms", "~m~Benutzung: ~s~/sms [Spieler] [Nachricht]", GreedyArg = true)] + public void CmdUserSMS(Player player, string name, string msg) + { + if (!player.IsLoggedIn()) return; + + Player target = PlayerService.GetPlayerByNameOrId(name); + if (target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(player); + return; + } + + if (target == player) + { + ChatService.ErrorMessage(player, "Du kannst dir keine SMS schreiben"); + return; + } + + msg = Regex.Replace(msg, "(~[a-zA-Z]~)|(!{(.*)})", ""); + + ChatService.SendMessage(player, $"~y~SMS ~w~an ~y~{target.Name}~w~: {msg}"); + ChatService.SendMessage(target, $"~y~SMS ~w~von ~y~{player.Name}~w~: { msg }"); + } + [Command("look", "~m~look")] public void CmdUserLook(Player player) {