> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-advanced-hunting/installation.md).

# Installation

## Prerequisites

* **RedM Server** with FXServer
* **VORP Core** — latest version
* **VORP Inventory** — latest version
* **oxmysql** — database resource
* **cas\_fwlibs** — framework library

## Step 1 — Database setup

Import `hunting.sql` into your database. It creates:

```sql
CREATE TABLE IF NOT EXISTS cas_hunting_xp (
  charid INT NOT NULL,
  xp INT NOT NULL DEFAULT 0,
  trace INT NOT NULL DEFAULT 0,
  language VARCHAR(10) NOT NULL DEFAULT 'en',
  language_selected TINYINT(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (charid)
);
```

It also adds bait items to your inventory:

| Item             | Label            | Limit |
| ---------------- | ---------------- | ----- |
| `bait_corn`      | Dried Corn Bait  | 10    |
| `bait_apples`    | Fresh Apple Bait | 10    |
| `bait_salt`      | Salt Lick Block  | 5     |
| `bait_meat`      | Raw Meat Scraps  | 10    |
| `bait_blood`     | Blood Trail Lure | 5     |
| `bait_legendary` | Legendary Bait   | 3     |
| `bait_grain`     | Grain Mix        | 15    |
| `bait_seeds`     | Premium Seeds    | 10    |
| `bait_exotic`    | Exotic Pheromone | 5     |

## Step 2 — Add the hunting map item

```sql
INSERT INTO `items` (`item`, `label`, `limit`, `can_remove`, `type`, `usable`)
VALUES ('huntingmap', 'Hunting Contract Map', 1, 1, 'item_standard', 1)
ON DUPLICATE KEY UPDATE `label` = VALUES(`label`);
```

## Step 3 — Resource installation

1. Extract the resource into your `resources` directory.
2. Rename the folder to `cas-hunting`.
3. Ensure the structure includes `client.lua`, `server.lua`, `config.lua`, `hunting.sql`, the `locales/` folder (`en`, `tr`, `fr`, `de`) and the `nui/` folder.

## Step 4 — server.cfg

```cfg
ensure oxmysql
ensure vorp_core
ensure vorp_inventory
ensure cas_fwlibs
ensure cas-hunting
```

## Step 5 — Verify

Start the server, connect, go to a hunting location (default: near Valentine) and press **G** to open the hunting menu. If it opens, installation succeeded.

## Common installation issues

* **"cas\_fwlibs export cannot be fetched"** — ensure `cas_fwlibs` starts before `cas-hunting`.
* **Database errors** — verify oxmysql config and credentials, and that the tables were created.
* **NUI not loading** — clear the NUI cache (F8 `clear`), verify the `nui/` folder exists, check F8 for JS errors.
* **Items not working** — re-run the SQL, restart `vorp_inventory`, and check item names match exactly.
