C#:
using ConVar;
namespace Oxide.Plugins
{
[Info("Hand Cuff Restore", "Khan", "1.0.1")]
[Description("Restore a player's status of being hand-cuffed from the double cuffing glitch.")]
public class HandCuffRestore : RustPlugin
{
private Translate.Phrase cuffs = new Translate.Phrase("HandCuff", "Cannot double cuff a player.");
private object OnPlayerHandcuff(BasePlayer victim, BasePlayer handcuffer)
{
if (victim != null && victim.IsRestrained)
{
handcuffer.ShowToast(GameTip.Styles.Error, cuffs, true);
return false;
}
return null;
}
[ChatCommand("restorecuffs")]
private void RestoreCuffedPlayer(BasePlayer player, string command, string[] args, bool console = false)
{
if (args.Length == 1)
{
BasePlayer found = null;
if (ulong.TryParse(args[0], out ulong id))
found = BasePlayer.FindByID(id);
if (found != null) player = found;
else
{
player.ChatMessage($"Could not find player ID {args[0]}");
return;
}
}
if (player != null && player.IsRestrained && player.GetActiveItem() == null)
{
Puts($"Restoring hand cuffed user {player.UserIDString} | {player.displayName}");
player.SetPlayerFlag(BasePlayer.PlayerFlags.IsRestrained, false);
player.restraintItemId = new ItemId?();
player.inventory.SetLockedByRestraint(false);
if (player.IsBot) Inventory.EquipItemInSlot(player, 0);
player.ClientRPC(RpcTarget.Player("CL_SetLocked", player), false);
player.ChatMessage("Restored hand cuffed status!");
}
}
}
}