# Configuration

Below is a **condensed** example of your <mark style="color:yellow;">`Config.lua`</mark>, showing the **essential** parameters for an advanced metal detecting system. You can expand or adjust as needed for your server.

```lua
Config = {}

-- Framework selection: "auto", "esx", or "qb"
Config.Framework = "auto"
Config.Language  = "en"     -- en, de, fr, sp, pt
Config.DiscordImage = true  -- If true, uses an image in Discord embed
Config.MoneyType = "EUR"    -- Display currency type in NUI (e.g., "USD", "EUR")
Config.ChestModel = "xm_prop_x17_chest_closed"

Config.digTime = 8000       -- ms for the digging progress bar
Config.Item    = "metal_detector"

Config.Price = {
    buy  = 2500,            -- Cost to buy a metal detector
    rent = 500              -- Cost to rent a metal detector
}

-- Keys to disable while scanning/digging
Config.DisableKeys = {21, 24}

-- Shop & NPC
Config.Shop = {
    marker = false,
    npc = true,
    model = "s_m_y_dockwork_01",
    coord = vec4(-1368.8090, -1492.8373, 3.4431, 83.1140),

    blip = {
        label   = "Metal Detector Shop",
        sprite  = 605,
        scale   = 0.7,
        color   = 5,
        visible = true
    }
}

-- Tasks / Achievements
Config.Tasks = {
    [1] = {
        type = "time",
        value = 30,  -- In minutes
        title = "Play 30 Minutes!",
        money = 3000,
        prize = {
            { item="pizza", image="images/items/pizza.png", amount=4 },
            { item="icedtea", image="images/items/icedtea.png", amount=3 }
        }
    },
    -- More tasks...
}

-- Rewards: Items discovered by digging
Config.Rewards = {
    ["jewelry"] = {
        title  = "Jewelry",
        price  = 500,
        chance = 20,
        score  = 80
        -- ...
    },
    ["rock"] = {
        title  = "Rock",
        price  = 25,
        chance = 35,
        score  = 10
        -- ...
    },
    -- More reward items...
}

-- Upgrades: Battery capacity, detection radius, radar, etc.
Config.Upgrades = {
    ["max_battery"] = {
        type        = "upgrade",
        title       = "BATTERY LEVEL",
        image       = "images/upgrades/battery.png",
        description = "...",
        levels = {
            [1] = { time=15 },
            [2] = { time=30, price=30000 },
            -- More levels...
        }
    },
    ["radar"] = {
        type        = "upgrade",
        title       = "RADAR LEVEL",
        image       = "images/upgrades/radar.png",
        description = "...",
        levels = {
            [1] = { radius=0.0 },
            [2] = { radius=50.0, price=50000 },
            [3] = { radius=30.0, price=50000 }
        }
    },
    ["battery"] = {
        type  = "item",
        title = "BATTERY CAPSULE",
        item  = "battery",
        time  = 5000,
        price = 5000
    },
    ["shovel"] = {
        type  = "item",
        title = "SHOVEL",
        item  = "shovel",
        price = 5000
    }
}

-- Localization
Config.Locales = {
    ["en"] = {
        success_buy = "You have successfully purchased it!",
        no_money    = "You don't have enough money!",
        -- ...
        digging     = "Digging...",
        cancel      = "Digging canceled!",
        -- ...
    },
    ["de"] = {
        success_buy = "Du hast es erfolgreich gekauft!",
        -- ...
    },
    -- ...
}

function getFramework()
    -- Auto-detection snippet:
    if Config.Framework == "esx" then
        return exports['es_extended']:getSharedObject(), "esx"
    elseif Config.Framework == "qb" then
        return exports["qb-core"]:GetCoreObject(), "qb"
    elseif Config.Framework == "auto" then
        if GetResourceState('qb-core') == 'started' then
            return exports["qb-core"]:GetCoreObject(), "qb"
        elseif GetResourceState('es_extended') == 'started' then
            return exports['es_extended']:getSharedObject(), "esx"
        end
    end
end

```

## <mark style="color:yellow;">**Highlights**</mark>

* **`Config.Framework`:** `"auto"` tries to see if `qb-core` or `es_extended` is active.
* **`Config.Tasks`:** Time-based or dig-based achievements awarding money and item prizes.
* **`Config.Rewards`:** Items discovered by digging, each with a `chance` and `score`.
* **`Config.Upgrades`:** Battery, radius, radar, or shovel (item). Levels may have `price` or extended time.
* **`Config.Locales`:** Quick multi-language support (English, German, etc.).


---

# 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://risk-scripts.gitbook.io/risk-scripts/scripts/advanced-metal-detector-script/configuration.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.
