This commit is contained in:
2021-04-07 17:34:18 +02:00
parent 5cea81de72
commit 78f4e136ee
5 changed files with 47 additions and 41 deletions

View File

@@ -1205,7 +1205,7 @@ namespace ReallifeGamemode.Server.Commands
[Command("respawnvehicle", "~m~Benutzung: ~s~/respawnvehicle (Db ID)", Alias = "rveh")]
public void CmdAdminRespawnVehicle(Player player, int id = -1)
{
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) //change back to Admin
{
ChatService.NotAuthorized(player);
return;

View File

@@ -426,21 +426,7 @@ namespace ReallifeGamemode.Server.Commands
if (nearestCuffPlayer is null)
return;
nearestCuffPlayer.SetInFrontOf(player);
nearestCuffPlayer.Heading = player.Heading;
if (!nearestCuffPlayer.HasAnimation("Cuffed"))
{
player.SyncAnimation("doArrest");
nearestCuffPlayer.SyncAnimation(new List<string>() { "getArrest", "Cuffed" });
player.AddAttachment("handcuffs", false);
}
else
{
player.AddAttachment("handcuffs", true);
player.SyncAnimation("doUncuff");
nearestCuffPlayer.SyncAnimation("getUncuff");
}
player.CuffPlayer(nearestCuffPlayer);
}
[Command("wanted", "~m~Benutzung: ~s~/wa(nted) [Spieler] [Anzahl] [Grund]", Alias = "wa", GreedyArg = true)]

View File

@@ -510,21 +510,7 @@ namespace ReallifeGamemode.Server.Events
}
if (nearestCuffPlayer != null)
{
nearestCuffPlayer.SetInFrontOf(player);
nearestCuffPlayer.Heading = player.Heading;
if (!nearestCuffPlayer.HasAnimation("Cuffed"))
{
player.SyncAnimation("doArrest");
nearestCuffPlayer.SyncAnimation(new List<string>() { "getArrest", "Cuffed" });
player.AddAttachment("handcuffs", false);
}
else
{
player.AddAttachment("handcuffs", true);
player.SyncAnimation("doUncuff");
nearestCuffPlayer.SyncAnimation("getUncuff");
}
player.CuffPlayer(nearestCuffPlayer);
}
}
if (nearestElevatorPoint != null)

View File

@@ -8,6 +8,7 @@ using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util;
/**
* @overview Life of German Reallife - Player Extension (PlayerExtension.cs)
@@ -322,9 +323,24 @@ namespace ReallifeGamemode.Server.Extensions
player.TriggerEvent("SERVER:SetInFrontPosition", entity);
}
public static void SetCuffable(this Player player, bool isCuffable)
public static void CuffPlayer(this Player player, Player nearestCuffPlayer)
{
player.SetSharedData("Cuffable", isCuffable);
nearestCuffPlayer.SetInFrontOf(player);
nearestCuffPlayer.Heading = player.Heading;
if (!nearestCuffPlayer.HasAnimation("Cuffed"))
{
player.SyncAnimation("doArrest");
nearestCuffPlayer.SyncAnimation(new List<string>() { "getArrest", "Cuffed" });
nearestCuffPlayer.AddAttachment("handcuffs", false);
nearestCuffPlayer.RemoveAllWeapons();
}
else
{
nearestCuffPlayer.AddAttachment("handcuffs", true);
player.SyncAnimation("doUncuff");
nearestCuffPlayer.SyncAnimation("getUncuff");
}
}
}
}