# Configuration

#### Basic Settings

```lua
Config.Debug = false -- Set to true for debugging purposes
Config.Framework = 'qb' -- 'auto', 'esx', 'qb'
Config.UseTarget = true -- ox_target, qb-target support else 'false' for 3D Text Interaction
Config.TargetResource = 'ox_target' -- 'ox_target', 'qb-target'
Config.Inventory = 'ox_inventory' -- 'ox_inventory', 'qb-inventory', 'esx_inventory', 'qs-inventory'
```

#### Notification System

```lua
Config.NotificationSystem = 'auto' -- 'auto', 'esx', 'qb', 'ox_lib', 'custom'
```

#### Controls

| Key             | Action        | Default |
| --------------- | ------------- | ------- |
| `close_ui`      | Close UI      | Escape  |
| `toggle_cart`   | Toggle Cart   | C       |
| `quick_payment` | Quick Payment | Enter   |
| `search_focus`  | Focus Search  | F       |

#### Animations

The script includes realistic animations for interactions:

* **Tablet Animation**: Used when browsing the market
* **Buying Animation**: Played during purchases

```lua
Config.Animations = {
    enabled = true,
    tablet = {
        dict = 'amb@world_human_seat_wall_tablet@female@base',
        anim = 'base',
        flag = 49
    },
    buying = {
        dict = 'mp_common',
        anim = 'givetake1_a',
        flag = 49
    }
}
```

### Store Setup

#### Basic Store Configuration

Each store requires the following basic configuration:

```lua
{
    id = 'store_id',
    label = 'Store Display Name',
    location = vector3(x, y, z),
    heading = 0.0
}
```

#### Blip Configuration

```lua
blip = {
    enabled = true,
    sprite = 52,
    color = 1,
    scale = 0.8,
    display = 4,
    shortRange = true,
    name = 'Black Market'
}
```

#### Ped Configuration

```lua
ped = {
    enabled = true,
    model = 'a_m_m_mexlabor_01',
    coords = vector4(x, y, z, heading),
    scenario = 'WORLD_HUMAN_SMOKING',
    frozen = true,
    invincible = true,
    blockevents = true
}
```

#### Interaction Settings

```lua
interaction = {
    distance = 3.0,
    label = '[E] Open Black Market',
    icon = 'fa-solid fa-shopping-cart'
}
```

### Access Control

#### Job Restrictions

Restrict access to specific jobs:

```lua
access = {
    jobs = {'police', 'ambulance'}, -- Empty array = all jobs
}
```

#### Gang Restrictions

Limit access to certain gangs:

```lua
access = {
    gangs = {'ballas', 'vagos'}, -- Empty array = all gangs 
}
```

#### Item Requirements

Require specific items to access the market:

```lua
access = {
    items = {'keycard', 'lockpick'}, -- Required items
}
```

### Product Management

#### Product Configuration

```lua
{
    name = 'item_name',           -- Item spawn name
    label = 'Display Name',       -- UI display name
    price = 100,                  -- Price in currency
    icon = 'fas fa-icon',         -- FontAwesome icon
    category = 'category_id',     -- Product category
    stock = 50,                   -- Available stock (-1 = unlimited)
    metadata = {}                 -- Additional item data
}
```

#### Weapon Metadata

For weapons, include additional metadata:

```lua
metadata = {
    ammo = 50,          -- Starting ammo
    components = {},    -- Weapon components
    tint = 0           -- Weapon tint
}
```

#### Categories

Available product categories:

| Category  | Icon          | Description |
| --------- | ------------- | ----------- |
| `market`  | shopping-cart | All Items   |
| `weapons` | crosshairs    | Weapons     |
| `drugs`   | pills         | Drugs       |
| `tools`   | tools         | Tools       |
| `gear`    | shield-alt    | Gear        |
| `medical` | band-aid      | Medical     |

### Payment Methods

#### Supported Payment Types

```lua
Config.PaymentMethods = {
    cash = {
        enabled = true,
        label = 'Cash',
        icon = 'fas fa-money-bill-wave'
    },
    bank = {
        enabled = true,
        label = 'Bank Card',
        icon = 'fas fa-credit-card'
    }
}
```

### Security Features

#### Anti-Cheat Protection

```lua
Config.AntiCheat = {
    enabled = true,
    maxDistance = 5.0,  -- Maximum interaction distance
    cooldown = 1000     -- Cooldown between purchases (ms)
}
```

### Discord Webhook

#### Setup

```lua
Config.Webhook = {
    enabled = true,
    url = 'YOUR_DISCORD_WEBHOOK_URL',
    botName = 'Black Market',
    title = 'Black Market Purchase',
    color = 16711680,
    footerText = 'Black Market System',
    footerIcon = 'https://i.imgur.com/youricon.png'
}
```

### Example Store Configurations

#### Downtown Market (Basic Setup)

```lua
{
    id = 'downtown_market',
    label = 'Downtown Black Market',
    location = vector3(707.84, -966.33, 30.41),
    heading = 90.0,
    
    blip = {
        enabled = true,
        sprite = 52,
        color = 1,
        scale = 0.8
    },
    
    access = {
        jobs = {},      -- Open to all jobs
        gangs = {},     -- Open to all gangs
        items = {},     -- No items required
        time = {},      -- 24/7 operation
        weather = {}    -- All weather
    }
}
```

#### Restricted High-Security Market

```lua
{
    id = 'secure_market',
    label = 'Secure Black Market',
    location = vector3(1905.82, 3828.16, 32.18),
    
    access = {
        jobs = {},
        gangs = {'ballas', 'vagos'},        -- Gang members only
        items = {'keycard'},                -- Requires keycard
        time = {start = 22, stop = 6},      -- Night only
        weather = {}
    }
}
```

### Troubleshooting

#### Common Issues

1. **Store not appearing**: Check coordinates and ensure the resource is started
2. **Ped not spawning**: Verify the ped model exists and coordinates are correct
3. **Access denied**: Review access restrictions in the store configuration
4. **Items not purchasing**: Ensure inventory system is properly configured

#### Debug Mode

Enable debug mode for detailed console output:

```lua
Config.Debug = true
```

#### Framework Detection

If auto-detection fails, manually set your framework:

```lua
Config.Framework = 'esx' -- or 'qb'
```
