diff --git a/source/BP-Essentials/BP-Essentials.csproj b/source/BP-Essentials/BP-Essentials.csproj index b88fecff..85c62a16 100644 --- a/source/BP-Essentials/BP-Essentials.csproj +++ b/source/BP-Essentials/BP-Essentials.csproj @@ -103,6 +103,7 @@ + diff --git a/source/BP-Essentials/Chat/Commands/Admin/ExecuteOnPlayer.cs b/source/BP-Essentials/Chat/Commands/Admin/ExecuteOnPlayer.cs index 7d451f4c..e1e58dcf 100644 --- a/source/BP-Essentials/Chat/Commands/Admin/ExecuteOnPlayer.cs +++ b/source/BP-Essentials/Chat/Commands/Admin/ExecuteOnPlayer.cs @@ -26,8 +26,7 @@ public static bool Run(object oPlayer, string message, string arg1) } else if (message.StartsWith(CmdJail) || message.StartsWith(CmdJail2)) { - float t; - if (float.TryParse(message.Split(' ').Last().Trim(), out t)) + if (float.TryParse(message.Split(' ').Last().Trim(), out float t)) { if (SendToJail.Run(shPlayer, t)) { @@ -64,13 +63,14 @@ public static bool Run(object oPlayer, string message, string arg1) } else if (message.Contains(CmdArrest)) { - shPlayer.svPlayer.Arrest(); + shPlayer.svPlayer.Arrest(shPlayer.manager.handcuffed); player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"Arrested " + shPlayer.username + $"."); } else if (message.Contains(CmdRestrain)) { - shPlayer.svPlayer.Arrest(); - shPlayer.svPlayer.SvSetEquipable(shPlayer.manager.restrained.index); + shPlayer.svPlayer.Arrest(shPlayer.manager.handcuffed); + ShRetained shRetained = shPlayer.curEquipable as ShRetained; + shPlayer.svPlayer.SvSetEquipable(shRetained.otherRetained.index); if (!shPlayer.svPlayer.IsServerside()) shPlayer.svPlayer.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, "You've been restrained"); player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"Restrained " + shPlayer.username + $"."); @@ -82,7 +82,7 @@ public static bool Run(object oPlayer, string message, string arg1) } else if (message.Contains(CmdFree)) { - shPlayer.svPlayer.Unhandcuff(); + UnRetain.Run(shPlayer.svPlayer); player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"Freed " + shPlayer.username + $"."); } found = true; diff --git a/source/BP-Essentials/EssentialsVariables.cs b/source/BP-Essentials/EssentialsVariables.cs index e3533433..9ef2e189 100644 --- a/source/BP-Essentials/EssentialsVariables.cs +++ b/source/BP-Essentials/EssentialsVariables.cs @@ -7,7 +7,7 @@ namespace BP_Essentials { public class EssentialsVariablesPlugin : EssentialsCorePlugin { - public const string Version = "2.4.3"; + public const string Version = "2.4.4"; // Generic Constants public const string FileDirectory = "Essentials/"; diff --git a/source/BP-Essentials/Methods/GameMethods/UnRetain.cs b/source/BP-Essentials/Methods/GameMethods/UnRetain.cs new file mode 100644 index 00000000..d5521f49 --- /dev/null +++ b/source/BP-Essentials/Methods/GameMethods/UnRetain.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using static BP_Essentials.EssentialsVariablesPlugin; +using static BP_Essentials.EssentialsMethodsPlugin; +using System.Reflection; + +namespace BP_Essentials +{ + class UnRetain : EssentialsVariablesPlugin + { + public static void Run(SvPlayer player) + { + try + { + typeof(SvPlayer).GetMethod(nameof(UnRetain), BindingFlags.NonPublic | BindingFlags.Instance).Invoke(player, new object[] {}); + } + catch (Exception ex) + { + ErrorLogging.Run(ex); + } + } + } +}