Request CanPickupLock hook (Rust)

Discussion in 'Feature Suggestions' started by k1lly0u, Jun 18, 2017.

  1. k1lly0u

    k1lly0u Grenade Master Plugin Developer

    Requesting CanPickupLock(BaseLock lock, BasePlayer player)
    Code (C#):

    // In the BaseLock class
    [MaxDistance(3f)]
        [RPC_Server]
        public void RPC_TakeLock(BaseEntity.RPCMessage rpc)
        {
            if (!rpc.player.CanInteract())
            {
                return;
            }
            if (base.IsLocked())
            {
                return;
            }
            object[] objArray = new object[] { this, rpc.player };
            object obj = Interface.CallHook("CanPickupLock", objArray);
            if (obj as bool)
            {
                return (bool)obj;
            }
            Item item = ItemManager.Create(this.itemType, 1, this.skinID);
            if (item != null)
            {
                rpc.player.GiveItem(item, BaseEntity.GiveItemReason.Generic);
            }
            base.Kill(BaseNetworkable.DestroyMode.None);
        }
     
    redBDGR likes this.