Rust Locking Belt Slots

Discussion in 'Plugin Requests' started by Ethereal 2, Nov 25, 2017.

  1. Hey! Wondering if there is any plugin or anyone can create a quick plugin to lock belt slots if you dont have permission to drop them! Thanks.
     
  2. Not gonna help you out with a plugin but here's the code if you still need it.
    Code:
    private void lockAll(BasePlayer player)
            {
                player.inventory.containerWear.SetLocked(true);
                player.inventory.containerBelt.SetLocked(true);
                player.SendNetworkUpdateImmediate();
            }
            private void unlockAll(BasePlayer player)
            {
                player.inventory.containerWear.SetLocked(false);
                player.inventory.containerBelt.SetLocked(false);
                player.SendNetworkUpdateImmediate();
            }
    
     
  3. Not sure that code of @Sonny-Boi will work (it will, but if i am not mistaken you will able to switch items in slots and swap items from belt to main), but final part of code should look like:
    Code:
    void Init() => permission.RegisterPermission("nameOfPlugin.useBelt", this);void OnPlayerInit(BasePlayer player)
    {
        if (player.isReceivingSnapshot)
        {
            NextTick(() => OnPlayerInit(player));
            return;
        }
        if (!permission.UserHasPermission(player.UserIDString, "nameOfPlugin.useBelt"))
        {
            player.inventory.containerWear.SetLocked(true);
            player.inventory.containerBelt.SetLocked(true);
            player.SendNetworkUpdateImmediate();
        }
    }