This commit is contained in:
2021-04-06 18:09:25 +02:00
parent b4fb23078b
commit 5ebdbb67ca
2 changed files with 46 additions and 2 deletions

View File

@@ -66,7 +66,7 @@
if (player == mp.players.local) { if (player == mp.players.local) {
blockInput = true; blockInput = true;
} }
} else if (!loop) { } else if (!loop && player.isPlayingAnim(animDict, animName, 3)) {
if (player == mp.players.local) { if (player == mp.players.local) {
blockInput = false; blockInput = false;
mp.events.callRemote("CLIENT:ClearAnimationData", player); mp.events.callRemote("CLIENT:ClearAnimationData", player);
@@ -127,6 +127,14 @@
mp.events.callRemote("CLIENT:SET_InFrontOfPos", result); mp.events.callRemote("CLIENT:SET_InFrontOfPos", result);
}); });
mp.events.add("SERVER:GetInFrontOfPlayer", (entity: PlayerMp) => {
let player = mp.players.local;
let result = xyInFrontOfPos(entity.position, entity.heading, 0.5);
result.z = player.position.z;
mp.players.local.heading = entity.heading;
mp.players.local.position = result;
});
function xyInFrontOfPos(pos, heading, dist): Vector3Mp { function xyInFrontOfPos(pos, heading, dist): Vector3Mp {
heading *= Math.PI / 180 heading *= Math.PI / 180
pos.x += (dist * Math.sin(-heading)) pos.x += (dist * Math.sin(-heading))

View File

@@ -34,6 +34,39 @@ namespace ReallifeGamemode.Server.Commands
{ {
#region Todo #region Todo
[Command("test_cuff1")]
public void TestCuff1(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;
Vector3 front = player.GetInFrontOfPosition();
front.Z = player.Position.Z;
target.Position = front;
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]")] [Command("cuff", "~m~Benutzung: ~s~/cuff [ID]")]
public void CmdCuffTest(Player player, string nameOrId) public void CmdCuffTest(Player player, string nameOrId)
{ {
@@ -46,7 +79,10 @@ namespace ReallifeGamemode.Server.Commands
if (target.Id == player.Id) if (target.Id == player.Id)
return; return;
target.Position = player.GetInFrontOfPosition(); Vector3 front = player.GetInFrontOfPosition();
front.Z = player.Position.Z;
target.Position = front;
target.Heading = player.Heading; target.Heading = player.Heading;
if (!target.HasAnimation("Cuffed")) if (!target.HasAnimation("Cuffed"))