# Installation

## Installation

Follow these steps to install the script correctly.

***

### Step 1 - Add Resource

Put the script folder into your server resources folder.

```txt
resources/[paid]/weaponskins
```

***

### Step 2 - Import SQL

Import the SQL file into your database.

```txt
sql/install.sql
```

SQL content:

```sql
CREATE TABLE IF NOT EXISTS `weapon_skins` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `identifier` VARCHAR(100) NOT NULL,
    `weapon` VARCHAR(50) NOT NULL,
    `skin` VARCHAR(50) NOT NULL,
    `equipped` TINYINT(1) DEFAULT 0,
    `purchased_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    UNIQUE KEY `unique_skin` (`identifier`, `weapon`, `skin`),
    INDEX `idx_identifier` (`identifier`),
    INDEX `idx_weapon` (`identifier`, `weapon`)
);
```

***

### Step 3 - Add to server.cfg

Add these lines to your `server.cfg`:

```cfg
ensure oxmysql
ensure weaponskins
```

If you use target or inventory systems, make sure they start before this script.

Example:

```cfg
ensure oxmysql
ensure ox_inventory
ensure ox_target
ensure weaponskins
```

***

### Step 4 - Configure Script

Open:

```txt
config.lua
```

Set your framework, inventory, target system, and shop location.

Basic example:

```lua
Config.Framework = "auto"
Config.Inventory = "ox_inventory"
Config.Target = "ox_target"
Config.Currency = "bank"
Config.CommandEnabled = true
Config.Command = "skinshop"
```

***

### Step 5 - Add Skin Textures

Put your `.ytd` skin files into:

```txt
stream/
```

Example:

```txt
stream/skin_gold.ytd
stream/skin_carbon.ytd
stream/skin_dragon.ytd
```

Important:

* Texture name inside `.ytd` must be `diffuse`

***

### Step 6 - Restart Server

Restart your server or ensure the resource:

```cfg
ensure weaponskins
```

***

### Step 7 - Test In Game

Use one of these methods:

```txt
- Go to the NPC shop
- Use target on NPC
- Use /skinshop if command is enabled
```

***

### Installation Check

If everything is correct, you should have:

```txt
- NPC spawned
- Blip visible
- UI opens correctly
- Weapons listed correctly
- Skins preview correctly
- Purchase and equip works
```


---

# 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://elena-scripts.gitbook.io/elenascripts/gameplay/weapon-skins/installation.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.
