> For the complete documentation index, see [llms.txt](https://igris-script.gitbook.io/igris-script/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://igris-script.gitbook.io/igris-script/paid-script/igris-lumberjack.md).

# Igris Lumberjack

<figure><img src="https://2862342791-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFnkzyjlqOP6UGw1GyN62%2Fuploads%2FaPuZk6guOjU1BkYgVnM7%2Flumberjack.png?alt=media&amp;token=87b37ba1-a48f-4037-943a-f6835f67ffec" alt=""><figcaption></figcaption></figure>

A lumberjack job for **RedM** servers running the **VORP** framework. Players go to a chopping spot, hold the prompt, chop the tree with an animation and a progress bar, and receive wood (plus optional bonus items). Job, axe, cooldown, distance and inventory space are all checked on the server.

***

### 📦 Requirements

| Resource          | Required | Link                                             |
| ----------------- | -------- | ------------------------------------------------ |
| vorp\_core        | ✅        | <https://github.com/VORPCORE/vorp-core-lua>      |
| vorp\_inventory   | ✅        | <https://github.com/VORPCORE/vorp_inventory-lua> |
| vorp\_progressbar | ✅        | <https://github.com/VORPCORE/vorp_progressbar>   |

A MySQL database is required to import the items.

***

### 🔧 Installation

#### 1. Add the resource

Put the `igris_lumberjack` folder in your server's `resources` folder.

> ⚠️ Do not rename the folder.

#### 2. Import the items

Run `lumberjack.sql` in your database (HeidiSQL, phpMyAdmin, etc.):

sql

```sql
INSERT IGNORE INTO items (`item`, `label`, `limit`, `can_remove`, `type`, `usable`) VALUES
    ('bois', 'Bois', 50, 1, 'item_standard', 0),
    ('hatchet', 'Hache', 1, 1, 'item_standard', 0);
```

| Item      | Default label | Purpose                         |
| --------- | ------------- | ------------------------------- |
| `bois`    | Bois (Wood)   | Reward received after each chop |
| `hatchet` | Hache (Axe)   | Tool required to chop           |

> 💡 **English server?** You can change the labels before importing, for example `'Wood'` and `'Axe'`. If you change the **item names** (`bois`, `hatchet`), also update `Config.WoodReward.name` and `Config.Tool.AxeItem` in `config.lua`.

> 💡 If the items already exist in your database, `INSERT IGNORE` will skip them.

#### 3. Start the resource

Add the following to your `server.cfg`, **after** the VORP resources:

cfg

```cfg
ensure vorp_core
ensure vorp_inventory
ensure vorp_progressbar

ensure igris_lumberjack
```

#### 4. Configure

Open `config.lua`, set your jobs, rewards, Discord webhook and texts, then restart your server.

***

### 🎮 How it works

1. A player with an allowed job sees the **chopping spots on the map** (blips).
2. Near a spot (2 m by default), a **"Chop wood"** prompt appears.
3. The player **holds SPACE** to start.
4. The server checks: **job → spot cooldown → axe in inventory → distance**.
5. The character plays the chopping animation with an axe in hand, and a progress bar starts (10 s by default).
6. The player can press **F** at any time to cancel.
7. At the end, the server checks everything again plus **inventory space**, then gives the rewards.
8. The spot goes on cooldown, the axe loses one use, and a Discord log is sent.

***

### ⚙️ Configuration

All settings are in `config.lua`. This file is not escrow-protected and can be fully edited.

#### Job restriction

lua

```lua
Config.Job = {
    Enabled = true,
    Names = { "scierieus", "woodsman", "forest" },
}
```

| Option    | Description                                                                           |
| --------- | ------------------------------------------------------------------------------------- |
| `Enabled` | `true` = only the listed jobs can chop and see the blips. `false` = everyone can chop |
| `Names`   | List of allowed job names. Must match the job names in your VORP database exactly     |

#### Axe, durability and prop

lua

```lua
Config.Tool = {
    AxeItem = "hatchet",

    Durability = {
        Enabled = true,
        UsesPerAxe = 20,
        RemoveOnBreak = true,
        NotifyBreak = "Ta hache s'est cassée !",
    },

    Prop = {
        Enabled = true,
        Model = "p_axe02x",
        Bone = 7966,
        Pos = { x = 0.0, y = 0.0, z = 0.0 },
        Rot = { x = 0.0, y = 0.0, z = 0.0 },
    }
}
```

| Option                     | Description                                                                                  |
| -------------------------- | -------------------------------------------------------------------------------------------- |
| `AxeItem`                  | Item name of the axe required to chop                                                        |
| `Durability.Enabled`       | Turns axe durability on or off                                                               |
| `Durability.UsesPerAxe`    | Number of chops before the axe breaks                                                        |
| `Durability.RemoveOnBreak` | `true` = the broken axe is removed from the inventory. `false` = durability is reset to full |
| `Durability.NotifyBreak`   | Message shown when the axe breaks                                                            |
| `Prop.Enabled`             | Shows an axe in the player's hand while chopping                                             |
| `Prop.Model`               | Prop model                                                                                   |
| `Prop.Bone`                | Ped bone the prop is attached to                                                             |
| `Prop.Pos` / `Prop.Rot`    | Position and rotation offsets of the prop                                                    |

> ℹ️ Durability is saved in the item metadata. The item description shows the remaining uses (for example *Durabilité: 15/20*).

#### Controls

lua

```lua
Config.Controls = {
    StartKey = 0xD9D0E1C0,  -- SPACE
    CancelKey = 0x3B24C470, -- F
}
```

| Option      | Description                                      |
| ----------- | ------------------------------------------------ |
| `StartKey`  | Key to hold to start chopping (hold time: 0.5 s) |
| `CancelKey` | Key to cancel while chopping                     |

> 💡 You can find RedM control hashes here: <https://github.com/femga/rdr3_discoveries/tree/master/Controls>

#### Interaction distance

lua

```lua
Config.InteractDistance = 2.0
```

Distance (in meters) at which the prompt appears near a spot.

#### Progress bar

lua

```lua
Config.Progress = {
    DurationMs = 10000,
    Label = "Coupe de l'arbre...",
    Theme = "innercircle",
    Color = "#ff0000",
    Width = "20vw",
}
```

| Option       | Description                                          |
| ------------ | ---------------------------------------------------- |
| `DurationMs` | Chopping time in milliseconds (`10000` = 10 seconds) |
| `Label`      | Text shown on the progress bar                       |
| `Theme`      | `linear`, `circle` or `innercircle`                  |
| `Color`      | Bar color (hex code)                                 |
| `Width`      | Bar width (CSS value)                                |

#### Cooldown and security

lua

```lua
Config.CooldownSeconds = 60
Config.MaxDistance = 6.0
```

| Option            | Description                                                                                                 |
| ----------------- | ----------------------------------------------------------------------------------------------------------- |
| `CooldownSeconds` | Time (in seconds) before a spot can be chopped again. The cooldown applies to the **spot**, for all players |
| `MaxDistance`     | Maximum distance between the player and the spot, checked on the server (anti-exploit)                      |

> ℹ️ Cooldowns are reset when the resource or the server restarts.

#### Blips

lua

```lua
Config.Blip = {
    Enabled = true,
    Sprite = -1321714808,
    Scale = 0.1,
}
```

| Option    | Description                |
| --------- | -------------------------- |
| `Enabled` | Shows the spots on the map |
| `Sprite`  | Blip sprite hash           |
| `Scale`   | Blip size                  |

> ℹ️ If the job restriction is enabled, blips are only shown to players with an allowed job.

#### Discord logs

lua

```lua
Config.DiscordLogs = {
    Enabled = true,
    Webhook = "Url_Webhook",
    Username = "Bucheron Igris",
    AvatarURL = "",
    Color = 65280,
}
```

| Option      | Description                                  |
| ----------- | -------------------------------------------- |
| `Enabled`   | Turns Discord logs on or off                 |
| `Webhook`   | Your Discord webhook URL                     |
| `Username`  | Name of the bot that posts the logs          |
| `AvatarURL` | Bot avatar (image URL, optional)             |
| `Color`     | Embed color (decimal value, `65280` = green) |

Each log includes the **player name**, the **spot** and the **rewards received**.

> ⚠️ If you don't use Discord logs, set `Enabled = false`.

#### Texts and translation

lua

```lua
Config.Text = {
    Prompt = {
        Title = "Bûcheron",
        Start = "Couper du bois",
    },
    Notify = {
        NotAllowed = "Tu n'es pas bûcheron.",
        NeedAxe = "Tu n'as pas de hache.",
        OnCooldown = "Ce spot est en cooldown.",
        TooFar = "Tu es trop loin du spot.",
        Canceled = "Action annulée.",
        GotNothing = "Tu n'as rien récupéré.",
        FullBag = "Inventaire plein: ",
        YouGot = "Tu as reçu: ",
    }
}
```

The default texts are in French. Example English translation, ready to paste:

lua

```lua
Config.Text = {
    Prompt = {
        Title = "Lumberjack",
        Start = "Chop wood",
    },
    Notify = {
        NotAllowed = "You are not a lumberjack.",
        NeedAxe = "You don't have an axe.",
        OnCooldown = "This spot is on cooldown.",
        TooFar = "You are too far from the spot.",
        Canceled = "Action canceled.",
        GotNothing = "You didn't get anything.",
        FullBag = "Inventory full: ",
        YouGot = "You received: ",
    }
}
```

> 💡 Also remember to translate `Config.Progress.Label`, `Config.Tool.Durability.NotifyBreak`, the spot `label` / `blipName` values and the item labels.

#### Wood reward

lua

```lua
Config.WoodReward = {
    name = "bois",
    label = "Bois",
    amount = 3,
}
```

| Option   | Description                                                               |
| -------- | ------------------------------------------------------------------------- |
| `name`   | Item name given to the player                                             |
| `label`  | Name shown in notifications and logs                                      |
| `amount` | **Exact** amount given per chop (whole number, 1 or more). No random roll |

#### Bonus items (optional)

lua

```lua
Config.BonusRewards = {
    Enabled = false,
    Items = {
        -- { name = "resin", label = "Resin", chance = 25, amount = 1 },
        -- { name = "bark", label = "Bark", chance = 10, amount = 2 },
    },
}
```

| Option    | Description                                                       |
| --------- | ----------------------------------------------------------------- |
| `Enabled` | `true` = bonus drops on. `false` = wood only                      |
| `name`    | Item name (must exist in your `items` table)                      |
| `label`   | Name shown in notifications                                       |
| `chance`  | Drop chance in percent (1 to 100). Each item is rolled separately |
| `amount`  | Amount given if the roll succeeds                                 |

> ⚠️ Add every bonus item to your database before you enable this option.

#### Chopping spots

lua

```lua
Config.Spots = {
    { label = "Forêt - Monto 1", coords = vector3(-1445.34, -249.34, 102.69), blipName = "Coupe de bois" },
    { label = "Forêt - Monto 2", coords = vector3(-1445.37, -254.39, 103.26), blipName = "Coupe de bois" },
    -- ...
}
```

| Option     | Description                      |
| ---------- | -------------------------------- |
| `label`    | Spot name (used in Discord logs) |
| `coords`   | Spot position (`vector3`)        |
| `blipName` | Name of the blip on the map      |

To add a spot, stand next to a tree in game, copy your coordinates and add a new line:

lua

```lua
{ label = "My Forest 1", coords = vector3(0.0, 0.0, 0.0), blipName = "Wood chopping" },
```

> 💡 Stand right next to the tree trunk when you copy your coordinates.

***

### ❓ FAQ / Troubleshooting

**The prompt doesn't show up near a spot.** Check that your character has one of the jobs in `Config.Job.Names` (or set `Config.Job.Enabled = false`). Without an allowed job, blips and the prompt are hidden. Also check that you are within `Config.InteractDistance` of the spot.

**"You don't have an axe."** The player needs the item set in `Config.Tool.AxeItem` (`hatchet` by default). Make sure the SQL has been imported.

**"Inventory full."** The player can't carry the reward. Free up some space or raise the item `limit` in the `items` table.

**The progress bar doesn't appear / error about `vorp_progressbar`.** Install `vorp_progressbar` and start it **before** `igris_lumberjack` in your `server.cfg`.

**Nothing shows up in Discord.** Check that `Config.DiscordLogs.Enabled = true` and that the webhook URL is correct and complete.

**A bonus item is never received.** Check that `Config.BonusRewards.Enabled = true`, that the item exists in your database, and that `chance` is between 1 and 100. A bonus item can't have the same name as the wood item.

**The axe in the hand is badly placed.** Adjust `Config.Tool.Prop.Pos` and `Config.Tool.Prop.Rot`.
