/sms übergangsweise eingefügt

This commit is contained in:
Luke
2021-05-08 18:05:26 +02:00
parent 6027ac1efd
commit 2ec2614530

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
@@ -90,6 +91,30 @@ namespace ReallifeGamemode.Server.Commands
player.SendNotification("Du hast dich zum Event teleportiert"); 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")] [Command("look", "~m~look")]
public void CmdUserLook(Player player) public void CmdUserLook(Player player)
{ {