/cuff Command (not tested)

This commit is contained in:
2021-04-06 05:30:18 +02:00
parent c6e3c6fecb
commit cc5304f775
2 changed files with 34 additions and 0 deletions

View File

@@ -34,6 +34,35 @@ namespace ReallifeGamemode.Server.Commands
{ {
#region Todo #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]")] [Command("syncanim", "~m~Benutzung: ~s~/syncanim [animName]")]
public void CmdSncAnim(Player player, string animName = null) public void CmdSncAnim(Player player, string animName = null)
{ {

View File

@@ -22,6 +22,11 @@ namespace ReallifeGamemode.Server.Util
player.SetSharedData("AnimationData", newAnimation); 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) public static void ClearAnimation(this Player player)
{ {
if (!player.HasData("Animation")) if (!player.HasData("Animation"))