# xakra\_publichanging

## Requirements

* [vorp\_core](https://github.com/VORPCORE/vorp-core-lua)

***

## Installation

1. Copy the script into a folder (to choose) from the 'resources' folder.
2. Add 'ensure xakra\_publichanging' in the 'Resources.cfg' document

***

## Config & Framework

<details open>

<summary>config.lua</summary>

{% code expandable="true" %}

```lua
Config = {} 

-- KEYS: https://github.com/femga/rdr3_discoveries/tree/master/Controls
Config.KeyLever = 'INPUT_INTERACT_OPTION1'
Config.KeyRope = 'INPUT_LOOT3'

Config.Texts = {
    NotJob = 'You do not have the required job',
    LeverPrompt = 'Open trapdoor',
    ClosePrompt = 'Close trapdoor',
    PutRope = 'Place rope',
    RemoveRope = 'Remove rope',
}

Config.Locations = {
    {
        Name = 'Valentine Gallows',
        Lever = { Model = 's_gallowlevernbx01x', Coords = vector3(-314.16, 731.11, 119.61) },
        TrapDoor = { Model = 's_gallowsstairs04x', Coords = vector3(-315.02, 733.53, 120.66) },
        Rope = { Coords = vector3(-315.08, 733.62, 123.0) },
        DeathTime = 20, -- number (seconds)
        Jobs = {    -- job list or false
            'sheriff',
            -- 'example',
        },
    },
    {
        Name = 'Rhodes Gallows',
        Lever = { Model = 's_gallowlevernbx01x', Coords = vector3(1373.51, -1216.83, 83.25) },
        TrapDoor = { Model = 's_gallowsstairs04x', Coords = vector3(1375.22, -1214.96, 84.28) },
        Rope = { Coords = vector3(1374.98, -1215.15, 86.67) },
        DeathTime = 20, -- number (seconds)
        Jobs = {    -- job list or false
            'sheriff',
            -- 'example',
        },
    },
    {
        Name = 'Strawberry Gallows',
        Lever = { Model = 's_gallowlevernbx01x', Coords = vector3(-1805.24, -337.15, 166.69) },
        TrapDoor = { Model = 's_gallowsdoor01x', Coords = vector3(-1806.55, -333.5, 167.7) },
        Rope = { Coords = vector3(-1806.64, -333.63, 169.7) },
        DeathTime = 20, -- number (seconds)
        Jobs = {    -- job list or false
            'sheriff',
            -- 'example',
        },
    },
    {
        Name = 'Blackwater Gallows',
        Lever = { Model = 's_gallowlevernbx01x', Coords = vector3(-766.64, -1260.87, 46.46) },
        TrapDoor = { Model = 's_gallowsstairs04x', Coords = vector3(-764.33, -1259.9, 47.45) },
        Rope = { Coords = vector3(-764.21, -1259.76, 49.62) },
        DeathTime = 20, -- number (seconds)
        Jobs = {    -- job list or false
            'sheriff',
            -- 'example',
        },
    },
    {
        Name = 'Saint Denis Gallows',
        Lever = { Model = 's_gallowlevernbx01x', Coords = vector3(2691.0, -1113.48, 51.87) },
        TrapDoor = { Model = 's_gallowdoornbx01x', Coords = vector3(2688.24, -1114.03, 52.92) },
        Rope = { Coords = vector3(2688.44, -1113.97, 54.52) },
        DeathTime = 20, -- number (seconds)
        Jobs = {    -- job list or false
            'sheriff',
            -- 'example',
        },
    },
    -- {
    --     Name = 'Annesburg Gallows',
    --     Lever = { Model = 's_gallowlevernbx01x', Coords = vector3(2906.16, 1300.92, 47.93) },   -- Annesburg has no lever
    --     TrapDoor = { Model = 's_gallowsstairs04x', Coords = vector3(2906.16, 1300.92, 47.93) },
    --     Rope = { Coords = vector3(2906.13, 1300.86, 50.01) },
    --     DeathTime = 20, -- number (seconds)
    --     Jobs = { -- job list or false
    --         'sheriff',
    --         -- 'example',
    --     },
    -- },
}
```

{% endcode %}

</details>

<details open>

<summary>framework</summary>

server.lua

{% code expandable="true" %}

```lua
local VORPcore = exports.vorp_core:GetCore()

function HasJob(source, jobs)
	local Character = VORPcore.getUser(source).getUsedCharacter

	for _, job in pairs(jobs) do
		if Character.job == job then
			return true
		end
	end

    return false
end

function Notify(source, text)
	VORPcore.NotifyObjective(source, text, 4000)
end

function OpenTrapdoorPlayer(index, source)	-- This function is called when the trapdoor is opened.
	-- Config.Locations[index]
	-- source (Hanging player id)
end

function CloseTrapdoorPlayer(index, source)	-- This function is called when the trapdoor is closed.
	-- Config.Locations[index]
	-- source (Hanging player id)
end

function PlayerDead(index, source)	-- This function is called when the player dies in public hanging.
	-- Config.Locations[index]
	-- source (Hanging player id)
end
```

{% endcode %}

</details>


---

# 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://xakra-scripts.gitbook.io/xakra-scripts-docs/redm-docs/xakra_publichanging.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.
