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

# Installation

### 1. Prerequisites

Before installing, ensure your server meets these requirements:

Framework: [ESX Legacy](https://github.com/esx-framework/esx_core) (New Version)

Dependencies:

* [ox\_target](https://github.com/overextended/ox_target) (Required for UI and interactions)
* [ox\_lib](https://github.com/overextended/ox_lib) (Required for UI and interactions)
* [ox\_inventory](https://github.com/overextended/ox_inventory) (Required for item management)
* [oxmysql](https://github.com/overextended/oxmysql) (Required for database storage)

### 2. Database Setup

The script requires a dedicated table to handle confiscated items during incarceration.

1. Open your database management tool (e.g., HeidiSQL, phpMyAdmin, or MySQL Workbench).
2. Execute the following SQL query to create and alter the necessary tables:

SQL

```
CREATE TABLE IF NOT EXISTS `duddzy_jail` (
  `identifier` VARCHAR(64) NOT NULL,
  `items` LONGTEXT DEFAULT NULL,
  PRIMARY KEY (`identifier`)
);

ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `jail_time` INT DEFAULT 0;
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `jail_bond` INT DEFAULT 0;
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `jail_skin` LONGTEXT DEFAULT NULL;
```

### 3. Installation Steps

1. Download: Download the latest release from [Duddzy Scripts Tebex](https://duddzy-scripts.tebex.io/).
2. Move to Resources: Drag the `dz_jail` folder into your server's `resources` directory.
3. Configure: Open `dz_jail/config.lua` and adjust the settings (Jail coordinates, jobs, and appearance system) to match your server’s specific needs.
4. Server Config: Add the following line to your `server.cfg`:

```
ensure dz_jail
```

### 4. Finalizing

1. **Restart your server** or ensure the resource is started by typing `refresh` then `ensure dz_jail` in your server console.
2. **Verify**: Log into your server and check if the NPCs appear at your configured locations.
3. **Permissions**: Ensure your police/sheriff job names in the `config.lua` match the job names in your ESX database exactly.

#### ⚠️ Common Troubleshooting

* **NPCs not spawning?** Ensure your `Config.Doctors` and `Config.RentalNPCs` coordinates are correct and the model names are valid standard GTA V ped names.
* **Inventory not clearing?** Verify that you are using `ox_inventory` and that your `Config.FuelSystem` settings are correctly linked to your current fuel resource.
* **Still having trouble?** Check your F8 console for errors, then reach out on our [Discord Server](https://discord.gg/your-link).
