# Installation

> Set up Sky Treasure Hunt with Sky Base, OneSync, oxmysql and the required inventory items.

## Requirements

<table>
<thead>
  <tr>
    <th>
      Requirement
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        sky_base
      </code>
    </td>
    
    <td>
      Framework, inventory, accounts, SQL and shared interactions
    </td>
  </tr>
  
  <tr>
    <td>
      OneSync
    </td>
    
    <td>
      Server-side position checks and shared activity state
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        oxmysql
      </code>
    </td>
    
    <td>
      Transactional persistence through Sky Base
    </td>
  </tr>
  
  <tr>
    <td>
      Configured inventory provider
    </td>
    
    <td>
      Equipment use, purchases and delivery of finds
    </td>
  </tr>
</tbody>
</table>

Set Sky Base's SQL provider to `oxmysql`. Treasure Hunt checks this at startup because progression and discovery updates use transactions. `ox_inventory` is supported through the inventory bridge, but is not a required inventory resource.

`sky_jobs_base` is not required for Treasure Hunt. Framework integration and character identity are provided by `sky_base`.

## Install

<steps>

### Place the resource

Extract your resource download and place the folder containing `fxmanifest.lua` in your server's `resources` directory. Keep its name **sky_treasurehunt**. Retain the included `stream`, `source/html`, configuration and credit files.

### Register all inventory items

Use [Inventory items](../reference/inventory-items) to register the 12 equipment items, 60 finds and the portable `treasure_album`. The resource includes English and German `ox_inventory` import templates and matching PNG images in `config/inventory/`.

Merge the definitions into the inventory you actually use. The resource's `import.sql` creates Treasure Hunt tables; it does **not** insert items into an ESX inventory database.

### Configure the database

Connect `oxmysql` to your database and configure it in Sky Base. Treasure Hunt creates its tables and applies its included migrations during startup. The database user needs permission to create and alter those tables and read and write their data.

`import.sql` is the manual table-creation reference for the current release. It does not disable startup migrations. See [Database and updates](../reference/database-and-updates) before updating an existing installation.

### Start dependencies first

Keep your existing framework and inventory setup, then use this order for the relevant resources:

```cfg [server.cfg]
ensure oxmysql
# Start your framework and inventory before Sky Base.
ensure sky_base
ensure sky_treasurehunt
```

Enable OneSync in your server configuration for server-side position checks and shared activities. The [FiveM server-command reference](https://docs.fivem.net/docs/server-manual/server-commands/#resource-commands) explains resource start commands.

### Choose the first settings

Check `Config.Locale`, `Config.Shop.locations` and `ServerConfig.Shop.Currency`. All four methods are enabled by default. Settings are edited in the shipped Lua files; there is no Treasure Hunt `/jobconfig` page.

</steps>

## Verify the installation

Join as a regular player and visit the dealer near the Vespucci docks. Confirm that the shop opens, the starter detector and shovel can be purchased and used, and a completed find enters the inventory. Reopen the album and reconnect to check that the discovery and progression remain.

Then try a magnet cast, a dive with a filled scuba set and one bin search. Use [First steps](./first-steps) for the workflow and [Troubleshooting](../reference/troubleshooting) if anything fails.
