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

# Undertaker

### ⚡ Getting Started

**For Vorp Core :**

* Simply set the job name in `Config.jobName` (default: `"undertaker"`).

**For Other Frameworks:**

* Enable the job using these events:

#### 🟦 Client Side

```lua
TriggerEvent("UnderBTaker:InitUnderTakerJob")
```

#### 🟧 Server Side

```lua
TriggerClientEvent("UnderBTaker:InitUnderTakerJob", source)
```

***

### 📦 Features

* Coffins and bodies are managed dynamically—coffins disappear automatically if there are no players around.
* Sell bodies for configurable rewards at set locations.
* Configurable blips, keys, prompts, and Discord logs.
* Cart and coffin system for full roleplay experience.

***

### ⚙️ Configuration Example (`config.lua`)

```lua
Config = {}
Config.DEBUG = false  -- Enable job for all on script start/restart

-- Job settings
Config.jobName  = "undertaker"    -- The job name -> VORP ONLY
Config.jobLabel = "Croque-Mort"   -- The job display label
Config.PopupTime = 3              -- Popup notification display time (seconds)

-- Corpse drop logic
Config.CanDropCorpse = true
Config.DropChance = 100

-- Prompts & keybinds
Config.PromptSell     = "Sell the body"
Config.SellKey        = keys["V"]
Config.PromptGetCart  = "Retrieve the cart"
Config.CartKey        = keys["C"]
Config.PromptPutCart  = "Put the body"
Config.CartPutKey     = keys["R"]
Config.PromptGetBody  = "Retrieve a coffin"
Config.PromptBodyKey  = keys["G"]

-- Map blips
Config.BlipsCart      = -243818172
Config.BlipsCartName  = "Cart - Croque-Mort"
Config.BlipsSellName  = "Coffin Sales - Croque-Mort"
Config.BlipsSell      = 1322310532

-- Discord integration
Config.DiscordWebhook = ""
Config.DiscordName    = "BT_UNDERTAKER"

-- Vehicle/cart management
Config.CanStoreCart = true
Config.CartCoords = {
    {
        ["GET"] = { x = 1299.56, y = -1320.52, z = 76.64 },
        ["OUT"] = { x = 1291.52, y = -1330.4, z = 77.52, heading = 71.4 }
    }
}

-- Coffin sales zones
Config.SellCoords = {
    { x = 1303.0, y = -1221.0, z = 80.8, distance = 60.0 },
    -- Add more zones as needed
}

-- Rewards for selling bodies
Config.Prices = {
    ["$"]    = { chance = 50, min = 2, max = 4 },
    ["Gold"] = { chance = 50, min = 1, max = 1 }
}

-- Localization / UI text
Config.Txt = {
    CantUseThisBody  = "You cannot add this body!",
    CantSellThisBody = "You cannot sell this body!",
    ZoneVehOrPed     = "The area is obstructed by a vehicle or a resident",
    TooFar           = "Warning, if you go too far the coffin will be abandoned.",
    FarGone          = "You have gone too far."
}
```

***

### 📌 Notes

* Coffins are **auto-cleaned** when the area is empty (no players nearby).
* Add or change prompt texts in `Config.Txt` to localize for your community.
* You can expand or restrict cart/vehicle spawn and sell zones easily with the coordinates tables.
* Use the Discord integration for staff logging or roleplay immersion.
