RackLock

RackLock

by bmgjet · updated 4 weeks ago · 15 downloads · ☆☆☆☆☆ no reviews
RackLock banner

Add codelocks to your weapon racks.

# RackLock

RackLock allows you to install Code Locks on Weapon Racks, giving you control over who can access the weapons stored inside.

Players with the required permission can equip a Code Lock and place it directly onto supported weapon racks. Once locked, the rack follows the Code Lock's access permissions, preventing unauthorized players from taking, mounting, loading, unloading, or swapping weapons.

Features

* 🔐 Add Code Locks to Weapon Racks
* 🛡️ Restrict access using the Code Lock whitelist
* 🚫 Prevent unauthorized players from:

* Taking weapons
* Mounting weapons
* Loading weapons
* Unloading weapons
* Swapping weapons
* 📍 Supports multiple weapon rack types:

* Weapon Rack Stand
* Weapon Rack Tall
* Weapon Rack Horizontal
* Weapon Rack Wide
* 🔧 Configurable Code Lock positioning for each rack type
* 🔊 Optional Code Lock sound effects
* 🏗️ Optional Building Privilege requirement
* 💡 Optional rack light that turns on when weapons are mounted
* 🖥️ Configurable placement indicator UI
* 🔑 Uses the standard Rust Code Lock item
* ⚡ Lightweight event-driven implementation

Permissions

| Permission | Description |
| -------------- | ----------------------------------------------------- |
| RackLock.Use | Allows the player to place Code Locks on Weapon Racks |

Players must have the RackLock.Use permission before they can use Code Locks with weapon racks.

How It Works

Give a player a Code Lock and the RackLock.Use permission.

Equip the Code Lock and look at a supported Weapon Rack. When the placement indicator appears, use the primary fire button to install the lock. The plugin automatically creates and attaches the Code Lock to the rack.

Once installed, the Code Lock controls access to the weapon rack. Players who are not authorized by the lock will be prevented from interacting with the rack, while authorized players can continue using it normally.

The Code Lock is automatically positioned according to the type of Weapon Rack being used.

Configuration

The plugin provides configuration options for:

| Setting | Description | Default |
| -------------------------------------- | --------------------------------------------------------- | ---------------- |
| Weapon Rack Stand Lock Position | Code Lock position on stand racks | 0, 1.03, 0 |
| Weapon Rack Tall Lock Position | Code Lock position on tall racks | -0.61, 0.96, 0 |
| Weapon Rack Horizontal Lock Position | Code Lock position on horizontal racks | -0.60, 0.58, 0 |
| Weapon Rack Wide Lock Position | Code Lock position on wide racks | -1.14, 0.58, 0 |
| Disable Code Lock Sound Effects | Disables Code Lock sounds | false |
| Gun Rack Require Building Privilege | Requires Building Privilege to use the rack | false |
| Switch Light On When Guns Mounted | Turns connected rack lighting on when weapons are mounted | false |
| CUI Refresh Rate | Placement UI refresh interval | 1.5 |

All of these settings are exposed in the plugin configuration.

Rack Lighting

When enabled, RackLock can control an IOEntity attached to the weapon rack.

The light is switched on when the rack contains weapons and switched off when the rack is empty. Existing wired connections are ignored so the plugin does not interfere with already-connected IO setups.

Installation

1. Download RackLock.cs
2. Place it into your server's oxide/plugins folder.
3. Grant players the required permission:

oxide.grant user <SteamID> RackLock.Use

4. Reload the plugin if necessary:

oxide.reload RackLock

5. Players with permission can now equip a Code Lock and place it on supported Weapon Racks.

Notes

RackLock automatically handles the Code Lock placement position for the supported rack prefabs. The lock is only added when the rack does not already have a lock installed.

If Building Privilege is enabled in the configuration, players must also be building authorized to interact with the rack.

---

Video