> For the complete documentation index, see [llms.txt](https://5scripts-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://5scripts-1.gitbook.io/docs/assets/5s_gathering/editable.md).

# Editable

## Editable

> **Note:** This documentation describes the functions in the `editable` folders. You are free to modify, extend, or adapt to fit your server's needs.

***

### Client Side (`client/editable/`)

#### 1. `keyBinds.lua`

**Key Hints System**

* **showKeyHints(type, subType)**
  * Displays key hints for the current action.
  * **Arguments:**
    * `type` *(string)*: Main mode (e.g., "mining\_ore").
    * `subType` *(string, optional)*: Sub-mode for more specific hints.
  * **Usage:** Shows hints using the `5s_keyhints_survival` resource.
* **hideKeyHints()**
  * Hides all currently displayed key hints.

**Keybinds**

* **mining**
  * **Default Key:** `MOUSE_LEFT`
  * **Description:** Triggers the mining action (calls `keybindHit()`).

***

#### 2. `events.lua`

* **isDead()**
  * Checks if the player's character is dead.
  * **Returns:** `true` if dead, otherwise `false`.

***

#### 3. `weapons.lua`

* **getCurrentWeapon()**
  * Gets the name of the currently equipped weapon using `ox_inventory` export.
  * **Returns:** Weapon name (`string`) or `nil` if none.

***

### Server Side (`server/editable/`)

#### 1. `inventory.lua`

* **canCarryItem(source, itemName, count)**
  * Checks if a player can carry a certain amount of an item.
  * **Arguments:**
    * `source` *(number)*: Player's server ID.
    * `itemName` *(string)*: Name of the item.
    * `count` *(number)*: Amount to check.
  * **Returns:** `true` if the player can carry, otherwise `false`.
* **addItem(source, itemName, count)**
  * Adds an item to the player's inventory.
  * **Arguments:**
    * `source` *(number)*: Player's server ID.
    * `itemName` *(string)*: Name of the item.
    * `count` *(number)*: Amount to add.
* **createDrop(source, itemName, count)**
  * Creates a custom item drop at the player's location if inventory is full.
  * **Arguments:**
    * `source` *(number)*: Player's server ID.
    * `itemName` *(string)*: Name of the item.
    * `count` *(number)*: Amount to drop.

***

#### 2. `validation.lua`

* **canMine(src, ore)**
  * Checks if a player can mine a specific ore.
  * **Arguments:**
    * `src` *(number)*: Player's server ID.
    * `ore` *(string)*: Name of the ore to mine.
  * **Returns:** `true` if the player can mine, otherwise `false`.
  * **Usage:** You can add custom validation (e.g., level checks, tool requirements, location restrictions).
* **checkDamage(src, ore, weapon, baseDamageForOre)**
  * Calculates the damage dealt by a player during mining.
  * **Arguments:**
    * `src` *(number)*: Player's server ID.
    * `ore` *(string)*: Name of the ore being mined.
    * `weapon` *(string)*: Name of the weapon/tool being used.
    * `baseDamageForOre` *(number)*: Base damage value for the ore.
  * **Returns:** Modified damage value *(number)*.
  * **Usage:** You can customize damage based on weapon type, player level, or other factors.
* **onHit(source, weapon, ore)**
  * Called when a player hits an ore with a weapon.
  * **Arguments:**
    * `source` *(number)*: Player's server ID.
    * `weapon` *(string)*: Name of the weapon/tool being used.
    * `ore` *(string)*: Name of the ore being mined.
  * **Usage:** You can decrease weapon durability here.

***

> All files in the `editable` folders are intended for easy customization without affecting the core logic. For further customization, refer to the comments and structure in each file.
