This commit is contained in:
2021-04-06 18:48:18 +02:00
parent 2b92e7134f
commit 4654638d9e
4 changed files with 6 additions and 27 deletions

View File

@@ -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) => {

View File

@@ -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)
{

View File

@@ -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;
}
}
}

View File

@@ -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<Vector3>("InFrontOf");
player.TriggerEvent("SERVER:SetInFrontPosition", entity);
}
}
}