# Installation

## STEP 1 - Dependencies

{% hint style="info" %}
**Dependencies:** It is important to use the dependencies that are indicated in this step, do not use others, otherwise you will receive critical errors
{% endhint %}

{% embed url="<https://github.com/overextended/oxmysql/releases>" %}

{% embed url="<https://github.com/overextended/ox_lib/releases>" %}

## STEP 2 - Start order

{% hint style="warning" %}
It is important to put the resources in the correct order, oxmysql should be started before es\_extended followed by ox\_lib (should be on top of your starting scripts)
{% endhint %}

In order for the resource to start correctly and not receive any errors, we must start the resources in the following order

```
ensure oxmysql
ensure ox_lib
```

## STEP 3 - Database

{% hint style="info" %}
You will need to insert the database that's included into the script and it's called into the

folder: deluxe-rewards.sql

In order to do that you will just need to run this sql in your db
{% endhint %}

```sql
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";

CREATE TABLE `deluxe_rewards` (
  `id` int(11) NOT NULL,
  `identifier` varchar(46) DEFAULT NULL,
  `rewardcount` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


ALTER TABLE `deluxe_rewards`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `deluxe_rewards`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
```

## STEP 4 - Script Config

{% hint style="info" %}
You can fully configure the script based on what your server needs. Here you can find a detailed explaination about all the possible configuration that you can use.
{% endhint %}

````lua
```lua
--[[    
  
           ______________________________________
  ________|           Deluxe Rewards             |_______
  \       |      deluxedevelopment.tebex.io      |      /
   \      |                                      |     /
   /      |______________________________________|     \
  /__________)                                (_________\                                                                           
  
    Discord Support: https://discord.gg/Ypt2m8FjRy

Version 1.0 | FREE RELEASE by Discord: jonyzeratv [Dev & Owner Deluxe Dev]

Before you go ahead make sure you have downloaded and installed these dependency or you might have issues running this script.
1] OXMySQL: https://github.com/overextended/oxmysql/releases
2] OXLib : https://github.com/overextended/ox_lib/releases

Make sure you have in your server cfg:

ensure oxmysql
ensure ox_lib

]]

Config = {}

Config.Framework = 'esx' -- Available: esx, qb 

-- Reward Key Setting
Config.KeyOpenUIMenu = 38 -- Reward Key to get the item [38 = E]	

Config.TimeToReward = 100 -- Time to get each reward

Config.Commands = {
	EnableShowCommand = true, -- Enable command to open UI? true/false
	ShowUICommand = 'showreward', -- Command to hide the reward UI
	EnableHideCommand = true, -- Enable command to close UI? true/false
	HideUICommand = 'hidereward' -- Command to hide the reward UI
}

Config.InventoryType = 'ox' -- Available esx, ox
Config.NotificationType = 'ox' -- Available esx, ox , okok , custom (If you set custom check below the function SetCustomNotification)
Config.OxAlignNotifications = 'center-left' -- Available: 'top' or 'top-right' or 'top-left' or 'bottom' or 'bottom-right' or 'bottom-left' or 'center-right' or 'center-left' [You must have Config.Notificationtype = 'ox']

---[[ You can add infinite rewards and set the item name that the player should receive and the quantity ]]---
---@param name | item name to give
---@param quantity | item quantity to give
Config.Rewards = {
	[0] = { name = 'burger', quantity = 4 },
	[1] = { name = 'money', quantity = 1000 },
	[2] = { name = 'weapon_pistol', quantity = 1 },
	[3] = { name = 'money', quantity = 1000 },
	[4] = { name = 'burger', quantity = 5 },
	[5] = { name = 'weapon_pistol', quantity = 1},
	[6] = { name = 'money', quantity = 500},
	[7] = { name = 'burger', quantity = 10 },
	[8] = { name = 'money', quantity = 1000 },
	[9] = { name = 'burger', quantity = 10 },
	[10] = { name = 'weapon_pistol', quantity = 2},
	-- You can add infinite rewards, when last reward is encountered, then it will start over
}

-- Translate everything according to your language there.
Config.Translation = {
    ["receive_reward"] = "[E] Receive Reward",
	["cant_collect"] = "Can't collect item",
	["you_received"] = "You just received ",
	["reward"] = "Reward: ",
}
```
````

## STEP 5 - Upload Images

```
// To upload items images you will just need to go into the directory
"web/build/images" and upload all the pictures for the items you want to add.
Make sure they are all .png files otherwise it won't load the picture.

```
