> For the complete documentation index, see [llms.txt](https://fetchq-store.gitbook.io/fetchq-store-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fetchq-store.gitbook.io/fetchq-store-docs/treasure-hunter-detector-and-diving-script.md).

# Treasure Hunter Detector & Diving Script

## 🗺️ FetchQ Treasure Hunter

An immersive, feature-rich treasure hunting and metal detecting script for FiveM servers. Allow your players to explore beaches, forests, deserts, and even dive into the ocean's depths to find hidden artifacts and valuable loot.

***

### 🌟 Overview

**FetchQ Treasure Hunter** introduces a dynamic mission-based scavenging system. Players can purchase different tiers of metal detectors and scuba tanks to complete expeditions. Ranging from finding rusty coins on the beach to discovering legendary alien artifacts in cave systems, this script offers a highly rewarding progression system.

***

### ✨ Features

#### 📡 Metal Detecting & Expeditions

* **Tiered Metal Detectors:** 5 different tiers (Basic, Advanced, Pro, Golden, Ultimate). Higher tiers offer larger scan ranges, better find rates, and faster signal speeds.
* **Custom Add-on Props:** The script includes custom high-quality 3D props for the different metal detector tiers (e.g., black, blue, orange, and golden variations) to enhance visual immersion.
* **Custom Animations & Effects:** Players visually hold the custom metal detector prop, and use a shovel animation with a dynamic rising prop effect when digging up treasure.
* **Diverse Mission Zones:** Specific mission types including Beach Search, Forest Expedition, Desert Treasure, Mountain Trek, and Cave Systems.
* **Difficulty Scaling:** Higher difficulty areas require better detectors and yield rarer items.

#### 🤿 Scuba Diving & Underwater Ruins

* **Deep Sea Exploration:** Dedicated underwater search missions for submerged ruins.
* **Tiered Scuba Tanks:** 3 levels of scuba tanks providing different oxygen durations (300s, 600s, 1200s) for prolonged dives.
* **Boat Integration:** Spawns a boat for diving missions with a specified pickup and return location.

#### 🎒 Loot System & Rarities

* **Dynamic Loot Pools:** Each mission zone has its own configured loot pool and drop weights.
* **Item Rarities:** Items are categorized into Common, Uncommon, Rare, Epic, and Legendary.
* **Vast Item Variety:** Find everything from Junk (Rusty Tin Cans, Broken Bottles) to Valuables (Gold Bars, Diamond Rings) and Legendary Relics (Ancient Swords, Alien Artifacts, Treasure Chests).

#### 👥 Multiplayer & Group Play

* **Group Missions:** Players can invite nearby friends (up to 4 members) to join their expedition.
* **Contribution Rewards:** Group reward modes ensure fair distribution based on player contribution.

#### ⚙️ System & Administration

* **Framework Auto-Detection:** Seamlessly integrates with your active framework.
* **Database Logging:** Uses `oxmysql` to log all mission history (items found, money earned, status) to prevent abuse and track player progress.
* **NPC Integration:** A configurable NPC (with Blip and Scenario) to start missions and interact with hunters.

***

### 🚀 Installation & Configuration

#### 1. Database Setup (SQL)

The script uses `oxmysql` to log history. It attempts to auto-create the table, but you can run this manually in your database if needed:

#### 2. Item Configuration

Item images are provided in the `itemimages/` folder. Place them in your inventory's image directory.

> \[!IMPORTANT] **For ox\_inventory (`data/items.lua`):** Add the provided items from the `README.md` to your `items.lua` file. This includes the junk items, valuable relics, metal detectors (`basic_detector`, `advanced_detector`, etc.), and scuba tanks (`tank_level_1`, etc.). Set `stack = false` and `close = true` for usable tools.

> \[!IMPORTANT] **For qb-core / qs-inventory (`shared/items.lua`):** Use the legacy table format provided in the `README.md` to define items. Ensure all detectors and tanks are set with `unique = true` and `useable = true`.

#### 3. Developer / Admin Commands

> \[!NOTE] `Config.Debug = false` by default.

* **Command:** Use `/treasuredebug` to test missions.
* **Permission:** Requires `treasure.admin` ACE permission.

***

### 🛠️ Customization (`config.lua`)

You can easily customize almost every aspect of the script in `config.lua`:

* **Economy:** Change item sell values in `Config.Items`.
* **Missions:** Edit mission coordinates, radius, required equipment, and item pools in `Config.Missions`.
* **Cooldowns:** Adjust the wait time between expeditions via `Config.MissionCooldown`.
* **Multiplayer:** Modify invite ranges and max group sizes in `Config.Multiplayer`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://fetchq-store.gitbook.io/fetchq-store-docs/treasure-hunter-detector-and-diving-script.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
