/cuff Command (not tested)
This commit is contained in:
@@ -34,6 +34,35 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
#region Todo
|
||||
|
||||
[Command("cuff", "~m~Benutzung: ~s~/cuff [ID]")]
|
||||
public void CmdSncAnim(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;
|
||||
|
||||
float rad = player.Heading * MathF.PI / 180;
|
||||
Vector3 forward = new Vector3(player.Position.X + (1.2 * MathF.Sin(rad)), player.Position.Y + (1.2 * MathF.Cos(rad)), player.Position.Z);
|
||||
|
||||
target.Position = forward;
|
||||
|
||||
if (!target.HasAnimation("Cuffed"))
|
||||
{
|
||||
player.SyncAnimation("doArrest");
|
||||
target.SyncAnimation("getArrest");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SyncAnimation("doUncuff");
|
||||
target.SyncAnimation("getUncuff");
|
||||
}
|
||||
}
|
||||
|
||||
[Command("syncanim", "~m~Benutzung: ~s~/syncanim [animName]")]
|
||||
public void CmdSncAnim(Player player, string animName = null)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,11 @@ namespace ReallifeGamemode.Server.Util
|
||||
player.SetSharedData("AnimationData", newAnimation);
|
||||
}
|
||||
|
||||
public static bool HasAnimation(this Player player, string animationName)
|
||||
{
|
||||
return player.HasData("Animation") && (player.GetData<string>("AnimationData") == animationName);
|
||||
}
|
||||
|
||||
public static void ClearAnimation(this Player player)
|
||||
{
|
||||
if (!player.HasData("Animation"))
|
||||
|
||||
Reference in New Issue
Block a user