# Installation

This guide will walk you through the installation process of **Madonne DOJ** on your FiveM server.

## Prerequisites

Before installing Madonne DOJ, make sure you have:

* ✅ A **FiveM Server** up and running
* ✅ A **MySQL Database** configured

## Installation Steps

Follow these steps to install Madonne DOJ on your server:

### Step 1: Download the Resource

Download the `MS_MaodonneDOJ` resource and place it in your server's `resources` folder.

```
resources/
  └── MS_MaodonneDOJ/
```

### Step 2: Import the Database

Execute the SQL file to create the necessary database tables:

```sql
-- Execute the db.sql file in your MySQL database
```

You can import it using:

* **phpMyAdmin**: Import the `db.sql` file
* **MySQL Command Line**:

  ```bash
  mysql -u username -p database_name < db.sql
  ```
* **HeidiSQL** or any other database management tool

### Step 3: Configure the Script

Open the `config.lua` file and configure it according to your server's needs.

At minimum, you should configure:

```lua
CONFIG_MADONNE_DOJ = {
  OpenTabletCmd = "tablet", -- Command to open the tablet
  DebugMode = false, -- Set to true only for debugging
  LocaleUi = "en", -- "fr" or "en"
  
  Services = {
    -- Configure your police and justice services here
  },
  
  Webhooks = {
    WarrantView = "YOUR_DISCORD_WEBHOOK_URL_HERE"
  }
}
```

For detailed configuration options, see the [Configuration Guide](https://documentation.madonnestudio.com/paid-scripts/madonnedoj/configuration).

### Step 4: Add to Server Configuration

Add the resource to your `server.cfg` file:

```cfg
ensure MS_MaodonneDOJ
```

Make sure it's placed **after** your framework (ESX/QBCore) in the load order.

**Example:**

```cfg
ensure es_extended
ensure oxmysql
ensure MS_MaodonneDOJ
```

### Step 5: Restart Your Server

Restart your FiveM server to load the resource:

```bash
restart MS_MaodonneDOJ
```

Or restart the entire server if you prefer.

## Verification

To verify the installation was successful:

1. **Check the server console** for any errors
2. **Join your server** as a player
3. **Type the command** `/tablet` (or the command you configured)
4. The tablet interface should open successfully

## Troubleshooting

### The tablet won't open

* ✅ Check that you have the necessary permissions in your job/service
* ✅ Verify the command in `config.lua` matches what you're typing
* ✅ Check the server console for errors

### Database errors

* ✅ Ensure `db.sql` was imported correctly
* ✅ Check your database credentials
* ✅ Verify all tables were created

### Configuration errors

* ✅ Make sure your `config.lua` syntax is correct
* ✅ Verify all required fields are filled
* ✅ Enable `DebugMode = true` to see detailed logs

## Next Steps

Now that Madonne DOJ is installed, you should:

1. [**Configure your services**](https://documentation.madonnestudio.com/paid-scripts/madonnedoj/configuration/services-configuration) - Set up your police and justice departments
2. [**Learn how to use it**](https://documentation.madonnestudio.com/paid-scripts/madonnedoj/usage) - Understand the tablet interface
3. [**Set up language**](https://github.com/DylanPageot/DocumentationAddonsScripts/blob/main/paid-scripts/madonnedoj/broken-reference/README.md) - Configure your preferred language

***

Need help? Check our [Support page](https://documentation.madonnestudio.com/paid-scripts/madonnedoj/support) or join our [Discord](https://discord.gg/madonne).
