diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index f61103e3..3804adc0 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -108,6 +108,7 @@ namespace ReallifeGamemode.Server.Commands { player.StopAnimation(); player.PlayAnimation("mp_am_hold_up", "handsup_base", (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl | AnimationFlags.Cancellable)); + ChatService.SendInRange(player.Position, 20, $"~m~{player.Name} stellt sich..."); } [Command("event", "~m~Benutzung: ~s~/event [Nachricht]", GreedyArg = true)] diff --git a/ReallifeGamemode.Server/Services/ChatService.cs b/ReallifeGamemode.Server/Services/ChatService.cs index 692c4263..255b30ad 100644 --- a/ReallifeGamemode.Server/Services/ChatService.cs +++ b/ReallifeGamemode.Server/Services/ChatService.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; @@ -115,6 +116,17 @@ namespace ReallifeGamemode.Server.Services }); } + internal static void SendInRange(Vector3 position, int range, string message) + { + foreach(Player player in NAPI.Pools.GetAllPlayers()) + { + if(player.Position.DistanceTo(position) <= range) + { + SendMessage(player, message); + } + } + } + public static void BroadcastGroup(string message, Group group) { message = $"!{{FF8080}}** Gruppe: {message}";