# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://botiv.gitbook.io/rdr2/undertaker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
