diff --git a/ReallifeGamemode.Client/util/animationSync.ts b/ReallifeGamemode.Client/util/animationSync.ts index bc72c362..34a5ae19 100644 --- a/ReallifeGamemode.Client/util/animationSync.ts +++ b/ReallifeGamemode.Client/util/animationSync.ts @@ -122,9 +122,8 @@ }, 100) } - mp.events.add("SERVER:GetInFrontPosition", () => { - let player = mp.players.local; - mp.events.callRemote("CLIENT:SET_InFrontOfPos", player.getOffsetFromInWorldCoords(0, 1, 0)); + mp.events.add("SERVER:SetInFrontPosition", (entity) => { + mp.events.callRemote("CLIENT:SET_InFrontOfPos", entity.getOffsetFromInWorldCoords(0, 1, 0)); }); mp.events.add("SERVER:GetInFrontOfPlayer", (entity: PlayerMp) => { diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index d967e836..56e00db1 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -46,27 +46,10 @@ namespace ReallifeGamemode.Server.Commands if (target.Id == player.Id) return; - Vector3 front = player.GetInFrontOfPosition(); - //front.Z = player.Position.Z; - target.Position = front; + target.SetInFrontOf(player); target.Heading = player.Heading; } - [Command("test_cuff2")] - public void TestCuff2(Player player, string nameOrId) - { - if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) - { - ChatService.NotAuthorized(player); - return; - } - Player target = PlayerService.GetPlayerByNameOrId(nameOrId); - if (target.Id == player.Id) - return; - - target.TriggerEvent("SERVER:GetInFrontOfPlayer", player); - } - [Command("cuff", "~m~Benutzung: ~s~/cuff [ID]")] public void CmdCuffTest(Player player, string nameOrId) { diff --git a/ReallifeGamemode.Server/Events/PlayerEvent.cs b/ReallifeGamemode.Server/Events/PlayerEvent.cs index 961d4b23..abd12a3c 100644 --- a/ReallifeGamemode.Server/Events/PlayerEvent.cs +++ b/ReallifeGamemode.Server/Events/PlayerEvent.cs @@ -10,7 +10,7 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("CLIENT:SET_InFrontOfPos")] public void SetFrontOfPos(Player player, Vector3 pos) { - player.SetData("InFrontOf", pos); + player.Position = pos; } } } diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index a72aab91..96b81700 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -317,12 +317,9 @@ namespace ReallifeGamemode.Server.Extensions user.Player.SetSharedData("blipColor", blipColor); } - public static Vector3 GetInFrontOfPosition(this Player player) + public static void SetInFrontOf(this Player player, Entity entity) { - player.ResetData("InFrontOf"); - player.TriggerEvent("SERVER:GetInFrontPosition"); - System.Threading.Thread.Sleep(500); - return player.GetData("InFrontOf"); + player.TriggerEvent("SERVER:SetInFrontPosition", entity); } } }