This commit is contained in:
2021-04-06 18:18:52 +02:00
parent 5ebdbb67ca
commit 62cde419f9
4 changed files with 4 additions and 5 deletions

View File

@@ -123,8 +123,7 @@
mp.events.add("SERVER:GetInFrontPosition", () => { mp.events.add("SERVER:GetInFrontPosition", () => {
let player = mp.players.local; let player = mp.players.local;
let result = xyInFrontOfPos(player.position, player.heading, 0.5); mp.events.callRemote("CLIENT:SET_InFrontOfPos", player.getOffsetFromInWorldCoords(0, 1, 0));
mp.events.callRemote("CLIENT:SET_InFrontOfPos", result);
}); });
mp.events.add("SERVER:GetInFrontOfPlayer", (entity: PlayerMp) => { mp.events.add("SERVER:GetInFrontOfPlayer", (entity: PlayerMp) => {

View File

@@ -47,7 +47,7 @@ namespace ReallifeGamemode.Server.Commands
return; return;
Vector3 front = player.GetInFrontOfPosition(); Vector3 front = player.GetInFrontOfPosition();
front.Z = player.Position.Z; //front.Z = player.Position.Z;
target.Position = front; target.Position = front;
target.Heading = player.Heading; target.Heading = player.Heading;
} }

View File

@@ -10,7 +10,7 @@ namespace ReallifeGamemode.Server.Events
[RemoteEvent("CLIENT:SET_InFrontOfPos")] [RemoteEvent("CLIENT:SET_InFrontOfPos")]
public void SetFrontOfPos(Player player, Vector3 pos) public void SetFrontOfPos(Player player, Vector3 pos)
{ {
player.SetSharedData("InFrontOf", pos); player.SetData("InFrontOf", pos);
} }
} }
} }

View File

@@ -320,7 +320,7 @@ namespace ReallifeGamemode.Server.Extensions
public static Vector3 GetInFrontOfPosition(this Player player) public static Vector3 GetInFrontOfPosition(this Player player)
{ {
player.TriggerEvent("SERVER:GetInFrontPosition"); player.TriggerEvent("SERVER:GetInFrontPosition");
return player.GetSharedData<Vector3>("InFrontOf"); return player.GetData<Vector3>("InFrontOf");
} }
} }
} }