> For the complete documentation index, see [llms.txt](https://highqez.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://highqez.gitbook.io/docs/resources/vehicle-armoury/installation.md).

# Installation

## Download Resource

{% hint style="success" %}
Purchase the script from our [HighQez Store](https://highqez.tebex.io/). After the purchase, the resource will be available in your [Keymaster Account](https://keymaster.fivem.net/asset-grants)
{% endhint %}

Make sure you purchase the script using the same [Keymaster Account](https://keymaster.fivem.net/) that is linked to your server. If not you will receive a warning "**You lack the required entitlement".**

If you receive the error mentioned above, you may have to transfer the resource from the current Keymaster account to the server's Keymaster account using the transfer feature in Keymaster.

***

## Transfer Resource

{% hint style="success" %}
Unzip the downloaded file and transfer it to your server's resource folder
{% endhint %}

If you are using **FTP**, please ensure you use [**WinSCP** ](https://winscp.net/eng/download.php)to transfer the resource to the server. If you use FileZilla, you may encounter the error "**Failed to verify protected resource**"

***

## Resource Dependency

{% hint style="success" %}
Make sure you have installed and started the below resources on your server
{% endhint %}

<table><thead><tr><th width="178">Name</th><th>Download Link</th></tr></thead><tbody><tr><td>ox_lib</td><td><a href="https://github.com/overextended/ox_lib/releases">https://github.com/overextended/ox_lib/releases</a></td></tr></tbody></table>

***

## Start Resource

{% hint style="success" %}
Ensure the resource in server.cfg of your server
{% endhint %}

Make sure to start the resource only after all essential server resources have been started. Follow the example below to **ensure highqez\_vehiclearmoury**

```
ensure es_extended/qb-core #Don't start above this
ensure ox_lib #Don't start above this
ensure inventory #Don't start above this

#Start the HighQez resource here

ensure highqez_vehiclearmoury

#Start the rest of your resources
```

***

## Resource Database

{% hint style="success" %}
Proceed the required SQL queue to your server database
{% endhint %}

Insert the SQL query from the attached file to use the resource, depending on your framework. See below for framework-specific SQL queries

<details>

<summary>SQL query</summary>

```sql
CREATE TABLE IF NOT EXISTS `vehiclearmoury` (
  `plate` varchar(50) NOT NULL,
  `data` longtext DEFAULT NULL,
  PRIMARY KEY (`plate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
```

</details>

***

## Configure Resource

{% hint style="success" %}
Customize the script to suit the specific requirements of your server
{% endhint %}

Open-source files are available for editing the framework function. The main configuration of the resource is provided below

<details>

<summary>Config File</summary>

{% code title="config.lua" %}

```lua

-- This function will auto detect the target script that is running
local function DetectTarget()
    local IS_ox_target = GetResourceState('ox_target') == 'started'
    local IS_qb_target = GetResourceState('qb-target') == 'started'
    if IS_ox_target then
        return 'ox_target'
    elseif IS_qb_target then
        return 'qb-target'
    else
        return 'none'
    end
end

-- This function will auto detect the inventory script that is running
local function DetectInventory()
    local IS_qs_inventory = GetResourceState('qs-inventory') == 'started'
    local IS_ox_inventory = GetResourceState('ox_inventory') == 'started'
    if IS_qs_inventory then
        return 'qs-inventory'
    elseif IS_ox_inventory then
        return 'ox_inventory'
    else
        return 'none'
    end
end

--[[
***********************************************
*                                             *
*            EDIT THE CONFIG BELOW            *
*                                             *
***********************************************
--]]

Config = {}

Config.Target = DetectTarget()  -- 'qb-target', 'ox_target' or DetectTarget() [Auto Detect]

Config.Inventory = DetectInventory() -- 'none', 'qs-inventory', 'ox_inventory' or DetectInventory() [Auto Detect]

Config.Jobs = { ['police'] = 0, ['sheriff'] = 0 } -- To restock the armoury (Only Works if Config.UnlimitedStock is false)

Config.ImageOnMenu = true -- If true, the item image will be shown on the menu(Only Works if Config.Inventory is 'none')

Config.Images = 'ox_inventory/web/images/' -- The path to the images folder, ONLY PNG is supported

Config.VehicleCategory = {
    ["class1"] = { -- The Category of the vehicle
        'police',  -- The vehicle that will be added to the category
        'police2',
    },
    ["class2"] = {
        'policeold1',
        'police3',  
    },
}

Config.Weapons = {
    ["class1"] = {  -- The items that will be added to the vehicle
        [1] = {name = "WEAPON_PISTOL", job = {['police'] = 0, ['sheriff'] = 0}, amount = 10}, -- Job = {['job_name'] = minimum_job_grade} OR Job = false
        [2] = {name = "WEAPON_APPISTOL", job = {['police'] = 0, ['sheriff'] = 0}, amount = 10},
        [3] = {name = "WEAPON_ASSAULTRIFLE", job = {['police'] = 3, ['sheriff'] = 3}, amount = 10},
        [4] = {name = "WEAPON_ASSAULTRIFLE_MK2", job = {['police'] = 2, ['sheriff'] = 2}, amount = 10},
        [5] = {name = "WEAPON_ASSAULTSMG", job = {['police'] = 1, ['sheriff'] = 1}, amount = 10},
        [6] = {name = "WEAPON_CARBINERIFLE", job = {['police'] = 1, ['sheriff'] = 1}, amount = 10},
        [7] = {name = "WEAPON_GRENADE", job = {['police'] = 1, ['sheriff'] = 1}, amount = 10},
    },
    ["class2"] = {  -- The items that will be added to the vehicle
        [1] = {name = "WEAPON_SMG", job = {['police'] = 0, ['sheriff'] = 0}, amount = 10},
        [2] = {name = "WEAPON_ASSAULTRIFLE", job = {['police'] = 0, ['sheriff'] = 0}, amount = 10},
        [3] = {name = "WEAPON_STICKYBOMB", job = {['police'] = 3, ['sheriff'] = 3}, amount = 10},
        [4] = {name = "WEAPON_ASSAULTRIFLE_MK2", job = {['police'] = 2, ['sheriff'] = 2}, amount = 10},
        [5] = {name = "WEAPON_ASSAULTSMG", job = {['police'] = 1, ['sheriff'] = 1}, amount = 10},
        [6] = {name = "WEAPON_CARBINERIFLE", job = {['police'] = 1, ['sheriff'] = 1}, amount = 10},
        [7] = {name = "WEAPON_GRENADE", job = {['police'] = 1, ['sheriff'] = 1}, amount = 10},
    },
}

Config.UnlimitedStock = false -- If true, the stock will be unlimited and the restocking charge will be ignored.

Config.RestockingCharge = { -- The price to restock each vehicle (Only Works if Config.UnlimitedStock is false)
    ['class1'] = 10000,
    ['class2'] = 20000,
}

Config.RestockingLocations = {   -- The locations to restock the vehicle (Only Works if Config.UnlimitedStock is false)
    vector4(458.6814, -1022.4894, 28.2769, 93.0602),
    vector4(-482.1316, 6018.5972, 31.3405, 317.6908),
}

--## EDIT THE BELOW IF YOU ARE USING DEFAULT ESX WHICH CONSIDER THE WEAPONS NOT AN ITEM (Ignore this for 'qs-inventory' and 'ox_inventory')
Config.ServerWeapons = {  -- Add the weapons you added in Config.Weapons (Ignore this for 'qs-inventory' and 'ox_inventory')

    --[[
    -- Melee
    weapon_dagger = { label = 'Dagger' },
    weapon_bat = { label = 'Bat' },
    weapon_bottle = { label = 'Broken Bottle' },
    weapon_crowbar = { label = 'Crowbar' },
    weapon_flashlight = { label = 'Flashlight' },
    weapon_golfclub = { label = 'Golfclub' },
    weapon_hammer = { label = 'Hammer' },
    weapon_hatchet = { label = 'Hatchet' },
    weapon_knuckle = { label = 'Knuckle' },
    weapon_knife = { label = 'Knife' },
    weapon_machete = { label = 'Machete' },
    weapon_switchblade = { label = 'Switchblade' },
    weapon_nightstick = { label = 'Nightstick' },
    weapon_wrench = { label = 'Wrench' },
    weapon_battleaxe = { label = 'Battle Axe' },
    weapon_poolcue = { label = 'Poolcue' },
    weapon_briefcase = { label = 'Briefcase' },
    weapon_briefcase_02 = { label = 'Suitcase' },
    weapon_garbagebag = { label = 'Garbage Bag' },
    weapon_handcuffs = { label = 'Handcuffs' },
    weapon_bread = { label = 'Baquette' },
    weapon_stone_hatchet = { label = 'Stone Hatchet' },
    weapon_candycane = { label = 'Candy Cane' },

    -- Handguns
    weapon_pistol = { label = 'Walther P99' },
    weapon_pistol_mk2 = { label = 'Pistol Mk II' },
    weapon_combatpistol = { label = 'Combat Pistol' },
    weapon_appistol = { label = 'AP Pistol' },
    weapon_stungun = { label = 'Taser' },
    weapon_pistol50 = { label = 'Pistol .50' },
    weapon_snspistol = { label = 'SNS Pistol' },
    weapon_heavypistol = { label = 'Heavy Pistol' },
    weapon_vintagepistol = { label = 'Vintage Pistol' },
    weapon_flaregun = { label = 'Flare Gun' },
    weapon_marksmanpistol = { label = 'Marksman Pistol' },
    weapon_revolver = { label = 'Revolver' },
    weapon_revolver_mk2 = { label = 'Violence' },
    weapon_doubleaction = { label = 'Double Action Revolver' },
    weapon_snspistol_mk2 = { label = 'SNS Pistol Mk II' },
    weapon_raypistol = { label = 'Up-n-Atomizer' },
    weapon_ceramicpistol = { label = 'Ceramic Pistol' },
    weapon_navyrevolver = { label = 'Navy Revolver' },
    weapon_gadgetpistol = { label = 'Perico Pistol' },
    weapon_pistolxm3 = { label = 'Pistol XM3' },

    -- Submachine Guns
    weapon_microsmg = { label = 'Micro SMG' },
    weapon_smg = { label = 'SMG' },
    weapon_smg_mk2 = { label = 'SMG Mk II' },
    weapon_assaultsmg = { label = 'Assault SMG' },
    weapon_combatpdw = { label = 'Combat PDW' },
    weapon_machinepistol = { label = 'Tec-9' },
    weapon_minismg = { label = 'Mini SMG' },
    weapon_raycarbine = { label = 'Unholy Hellbringer' },

    -- Shotguns
    weapon_pumpshotgun = { label = 'Pump Shotgun' },
    weapon_sawnoffshotgun = { label = 'Sawn-off Shotgun' },
    weapon_assaultshotgun = { label = 'Assault Shotgun' },
    weapon_bullpupshotgun = { label = 'Bullpup Shotgun' },
    weapon_musket = { label = 'Musket' },
    weapon_heavyshotgun = { label = 'Heavy Shotgun' },
    weapon_dbshotgun = { label = 'Double-barrel Shotgun' },
    weapon_autoshotgun = { label = 'Auto Shotgun' },
    weapon_pumpshotgun_mk2 = { label = 'Pumpshotgun Mk II' },
    weapon_combatshotgun = { label = 'Combat Shotgun' },

    -- Assault Rifles
    weapon_assaultrifle = { label = 'Assault Rifle' },
    weapon_assaultrifle_mk2 = { label = 'Assault Rifle Mk II' },
    weapon_carbinerifle = { label = 'Carbine Rifle' },
    weapon_carbinerifle_mk2 = { label = 'Carbine Rifle Mk II' },
    weapon_advancedrifle = { label = 'Advanced Rifle' },
    weapon_specialcarbine = { label = 'Special Carbine' },
    weapon_bullpuprifle = { label = 'Bullpup Rifle' },
    weapon_compactrifle = { label = 'Compact Rifle' },
    weapon_specialcarbine_mk2 = { label = 'Special Carbine Mk II' },
    weapon_bullpuprifle_mk2 = { label = 'Bullpup Rifle Mk II' },
    weapon_militaryrifle = { label = 'Military Rifle' },

    -- Light Machine Guns
    weapon_mg = { label = 'Machinegun' },
    weapon_combatmg = { label = 'Combat MG' },
    weapon_gusenberg = { label = 'Thompson SMG' },
    weapon_combatmg_mk2 = { label = 'Combat MG Mk II' },
    
    -- Sniper Rifles
    weapon_sniperrifle = { label = 'Sniper Rifle' },
    weapon_heavysniper = { label = 'Heavy Sniper' },
    weapon_marksmanrifle = { label = 'Marksman Rifle' },
    weapon_remotesniper = { label = 'Remote Sniper' },
    weapon_heavysniper_mk2 = { label = 'Heavy Sniper Mk II' },
    weapon_marksmanrifle_mk2 = { label = 'Marksman Rifle Mk II' },

    -- Heavy Weapons
    weapon_rpg = { label = 'RPG' },
    weapon_grenadelauncher = { label = 'Grenade Launcher' },
    weapon_grenadelauncher_smoke = { label = 'Smoke Grenade Launcher' },
    weapon_minigun = { label = 'Minigun' },
    weapon_firework = { label = 'Firework Launcher' },
    weapon_railgun = { label = 'Railgun' },
    weapon_railgunxm3 = { label = 'Railgun XM3' },
    weapon_hominglauncher = { label = 'Homing Launcher' },
    weapon_compactlauncher = { label = 'Compact Launcher' },
    weapon_rayminigun = { label = 'Widowmaker' },

    -- Throwables
    weapon_grenade = { label = 'Grenade' },
    weapon_bzgas = { label = 'BZ Gas' },
    weapon_molotov = { label = 'Molotov' },
    weapon_stickybomb = { label = 'C4' },
    weapon_proxmine = { label = 'Proxmine Grenade' },
    weapon_snowball = { label = 'Snowball' },
    weapon_pipebomb = { label = 'Pipe Bomb' },
    weapon_ball = { label = 'Ball' },
    weapon_smokegrenade = { label = 'Smoke Grenade' },
    weapon_flare = { label = 'Flare pistol' },

    -- Miscellaneous
    weapon_petrolcan = { label = 'Petrol Can' },
    weapon_fireextinguisher = { label = 'Fire Extinguisher' },
    weapon_hazardcan = { label = 'Hazardous Jerry Can' },

    ]]--
}
```

{% endcode %}

</details>

***
