# 0Gravity - Weapon Lock | Free

***

###

<figure><img src="https://2438262624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJHkJ8ef2uNJ5oXdd3vnX%2Fuploads%2FVlKjfon3k7szt5vfiGqR%2F0Gravity%20WeaponLock.png?alt=media&#x26;token=ac61b7b8-f03e-491a-a0cd-7dced224e5db" alt="" width="375"><figcaption></figcaption></figure>

### 📘 Overview

**Name:** 0Gravity Weapon Lock\
**Version:** 1.0\
**Framework:** Standalone\
**Library dependency:** [ox\_lib](https://overextended.dev/ox_lib/)\
**Author:** 0Gravity BVVS\
**Description:**\
A lightweight system that allows players to lock and unlock their firearm with a single key (default `L`). Locked weapons are disabled from firing until manually unlocked.

***

### 🚀 Features

✅ Toggle weapon lock with a key\
✅ Blocks only specific firearms\
✅ ox\_lib notifications and progressbar\
✅ Spam protection for alerts\
✅ Configurable lock/unlock time\
✅ Lightweight & standalone

***

### 🧠 How It Works

* Press `L` to lock or unlock your weapon.
* When locked, firing controls (`LMB`, `RMB`) are disabled.
* Unlocking triggers a progress bar before re-enabling weapon use.
* If the player tries to shoot while locked, they receive a notification (with cooldown).

***

### ⚙️ Configuration

Located in `config.lua`:

```lua
Config.ToggleKey = 182 -- Default: L
Config.UnlockTime = 3000 -- in milliseconds
Config.NotifyCooldown = 2000 -- time between notifications (ms)

Config.FireWeapons = {
    "WEAPON_PISTOL",
    "WEAPON_COMBATPISTOL",
    "WEAPON_APPISTOL",
    "WEAPON_SMG",
    "WEAPON_ASSAULTRIFLE",
    "WEAPON_CARBINERIFLE",
    "WEAPON_SNIPERRIFLE"
}
```

> You can customize which weapons are considered "firearms" and adjust timings easily.

***

### 🛠️ Installation

1. Make sure you have `ox_lib` installed and started before this script.
2. Copy the folder `0gravity_gunblock` into your `resources/` directory.
3.  Add the following to your `server.cfg`:

    ```
    ensure ox_lib
    ensure 0gravity_gunblock
    ```

***

### 🎮 Controls

| Key | Action                    |
| --- | ------------------------- |
| `L` | Toggle weapon lock/unlock |

***

### 📂 File Structure

```
0gravity_gunblock/
├── config.lua         # Configurable settings
├── client.lua         # Main script logic (locking/unlocking)
├── fxmanifest.lua     # Resource metadata
└── README.md          # Local readme in Polish
```

***

### ❗ Limitations (FREE VERSION)

* ❌ No support for ESX or QBCore out of the box
* ❌ No Discord webhook integration
* ❌ No language localization (hardcoded Polish text)
* ❌ No admin bypass or commands

***

### 📦 Dependencies

* [ox\_lib](https://overextended.dev/ox_lib/)

Make sure it's properly installed and initialized with `@ox_lib/init.lua`.

***

### 🧪 Example Flow

1. Player equips a weapon like a pistol.
2. Player presses `L` → Weapon is locked.
3. Player tries to shoot → Notification appears: **"Broń zablokowana"**
4. Player presses `L` again → Progress bar appears for 3 seconds.
5. Weapon is now unlocked and usable again.

***

### 📩 Support

Join the support Discord:\
[**https://discord.gg/YbuNXpwkWY**](https://discord.gg/YbuNXpwkWY)

***

Let me know if you'd like this exported to a `.md` file, or if you want a **PRO version roadmap** page added as well.
