---
description: 'Follow these steps for flawless instalation:'
---

# Installation Guide

1. Download the script from your [keymaster](https://keymaster.fivem.net/login?return_url=/).\

2. Place the script into your server resource folder:\
   &#xNAN;_`FXServer\server-data\resources\fivecode_carkeys`_\

3. Write the script into your server.cfg:\
   &#xNAN;_`ensure fivecode_carkeys`_\

4. Setup your inventory - o&#x78;**,** qb, qs, aq:

<details>

<summary><strong>ox</strong></summary>



Add the following into:\
&#xNAN;_`ox_inventory\modules\items\client.lua`_

```lua
Item('vehiclekeys', function(data, slot)
    TriggerServerEvent('fivecode_carkeys:useKeys', slot.metadata)
end)
```

and this into:\
&#xNAN;_`ox_inventory\data\items.lua`_

```lua
['vehiclekeys'] = {
    label = 'Vehicle Keys',
    weight = 10,
    stack = false,
    close = true,
},
```

</details>

<details>

<summary><strong>qb</strong></summary>

Add the following into:\
&#xNAN;_`qb-core\shared\items.lua`_

```lua
['vehiclekeys'] = {
	['name'] = 'vehiclekeys',
	['label'] = 'Vehicle Keys',
	['weight'] = 50,
	['type'] = 'item',
	['image'] = 'vehiclekeys.png',
	['unique'] = true,
	['useable'] = true,
	['shouldClose'] = true,
	['combinable'] = nil,
	['description'] = 'Advanced Vehicle Keys',
},
```

and this into:\
&#xNAN;_`qb-inventory/html/js/app.js`_

<pre class="language-lua"><code class="lang-lua"><strong>New:
</strong>else if (itemData.name == "vehiclekeys") {
    return `
        &#x3C;p>&#x3C;strong>${itemData.info.label}&#x3C;/strong>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Model: &#x3C;/strong>&#x3C;span>${itemData.info.model}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Plate: &#x3C;/strong>&#x3C;span>${itemData.info.plate}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>VIN: &#x3C;/strong>&#x3C;span>${itemData.info.vin}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Security key: &#x3C;/strong>&#x3C;span>${itemData.info.key}&#x3C;/span>&#x3C;/p>
    `;
}


<strong>Old:
</strong>else if (itemData.name == "vehiclekeys") {
        $(".item-info-title").html("&#x3C;p>" + itemData.info.label + "&#x3C;/p>");
        $(".item-info-description").html(
                "&#x3C;p>&#x3C;strong>Model: &#x3C;/strong>&#x3C;span>" +
                itemData.info.model +
                "&#x3C;p>&#x3C;strong>Plate: &#x3C;/strong>&#x3C;span>" +
                itemData.info.plate +
                "&#x3C;/span>&#x3C;/p>&#x3C;p>&#x3C;strong>VIN: &#x3C;/strong>&#x3C;span>" +
                itemData.info.vin +
                "&#x3C;/span>&#x3C;/p>&#x3C;p>&#x3C;strong>Security key: &#x3C;/strong>&#x3C;span>" +
                itemData.info.key +
                "&#x3C;/span>&#x3C;/p>"
	);
}
</code></pre>

</details>

<details>

<summary><strong>qs</strong></summary>

Add the following into:\
&#xNAN;_`qs-inventory\shared\items.lua`_

```lua
['vehiclekeys'] = {
	['name'] = 'vehiclekeys',
	['label'] = 'Vehicle Keys',
	['weight'] = 50,
	['type'] = 'item',
	['image'] = 'vehiclekeys.png',
	['unique'] = true,
	['useable'] = true,
	['shouldClose'] = true,
	['combinable'] = nil,
	['description'] = 'Advanced Vehicle Keys',
},
```

and this into:\
&#xNAN;_`qs-inventory\config\metadata.js`_

<pre class="language-lua"><code class="lang-lua"><strong>New:
</strong>else if (itemData.name == "vehiclekeys") {
    return `
        &#x3C;p>&#x3C;strong>${itemData.info.label}&#x3C;/strong>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Model: &#x3C;/strong>&#x3C;span>${itemData.info.model}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Plate: &#x3C;/strong>&#x3C;span>${itemData.info.plate}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>VIN: &#x3C;/strong>&#x3C;span>${itemData.info.vin}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Security key: &#x3C;/strong>&#x3C;span>${itemData.info.key}&#x3C;/span>&#x3C;/p>
    `;
}


<strong>Old:
</strong>else if (itemData.name == "vehiclekeys") {
        $(".item-info-title").html("&#x3C;p>" + itemData.info.label + "&#x3C;/p>");
        $(".item-info-description").html(
                "&#x3C;p>&#x3C;strong>Model: &#x3C;/strong>&#x3C;span>" +
                itemData.info.model +
                "&#x3C;p>&#x3C;strong>Plate: &#x3C;/strong>&#x3C;span>" +
                itemData.info.plate +
                "&#x3C;/span>&#x3C;/p>&#x3C;p>&#x3C;strong>VIN: &#x3C;/strong>&#x3C;span>" +
                itemData.info.vin +
                "&#x3C;/span>&#x3C;/p>&#x3C;p>&#x3C;strong>Security key: &#x3C;/strong>&#x3C;span>" +
                itemData.info.key +
                "&#x3C;/span>&#x3C;/p>"
	);
}
</code></pre>

</details>

<details>

<summary><strong>ps</strong></summary>

Add the following into:\
&#xNAN;_`qb-core\shared\items.lua`_

```lua
vehiclekeys = {
	name = 'vehiclekeys',
	label = 'Vehicle Keys',
	weight = 50,
	type = 'item',
	image = 'vehiclekeys.png',
	unique = true,
	useable = true,
	shouldClose = true,
	combinable = nil,
	description = 'Advanced Vehicle Keys',
},
```

And this to:\
p&#x73;_`-inventory/html/js/app.js`_

<pre class="language-lua"><code class="lang-lua"><strong>New:
</strong>else if (itemData.name == "vehiclekeys") {
    return `
        &#x3C;p>&#x3C;strong>${itemData.info.label}&#x3C;/strong>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Model: &#x3C;/strong>&#x3C;span>${itemData.info.model}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Plate: &#x3C;/strong>&#x3C;span>${itemData.info.plate}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>VIN: &#x3C;/strong>&#x3C;span>${itemData.info.vin}&#x3C;/span>&#x3C;/p>
        &#x3C;p>&#x3C;strong>Security key: &#x3C;/strong>&#x3C;span>${itemData.info.key}&#x3C;/span>&#x3C;/p>
    `;
}


<strong>Old:
</strong>else if (itemData.name == "vehiclekeys") {
        $(".item-info-title").html("&#x3C;p>" + itemData.info.label + "&#x3C;/p>");
        $(".item-info-description").html(
                "&#x3C;p>&#x3C;strong>Model: &#x3C;/strong>&#x3C;span>" +
                itemData.info.model +
                "&#x3C;p>&#x3C;strong>Plate: &#x3C;/strong>&#x3C;span>" +
                itemData.info.plate +
                "&#x3C;/span>&#x3C;/p>&#x3C;p>&#x3C;strong>VIN: &#x3C;/strong>&#x3C;span>" +
                itemData.info.vin +
                "&#x3C;/span>&#x3C;/p>&#x3C;p>&#x3C;strong>Security key: &#x3C;/strong>&#x3C;span>" +
                itemData.info.key +
                "&#x3C;/span>&#x3C;/p>"
	);
}
</code></pre>

</details>

<details>

<summary><strong>codem</strong></summary>

Add the following into:\
&#xNAN;_`codem-inventory\config\itemlist.lua`_

```lua
vehiclekeys = {
	name = 'vehiclekeys',
	label = 'Vehicle Keys',
	weight = 50,
	type = 'item',
	image = 'vehiclekeys.png',
	unique = true,
	useable = true,
	shouldClose = true,
	combinable = nil,
	description = 'Advanced Vehicle Keys',
},
```

</details>

<details>

<summary><strong>core</strong></summary>

Add the following into your database:

```sql
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`, `desc`) VALUES
    ('vehiclekeys', 'Vehicle Keys', 1, 0, 1, NULL);
```

</details>

<details>

<summary>aq</summary>

It is necessary to modify the export statement below:\
`aq-inventory/server/events/events.lua`

```lua
-- from:
exports[resource][func](source, item)
-- to:
exports[resource][func](nil, source, item)

```

and this into:\
&#xNAN;_`aq-inventory\shared\items/items.lua`_

```lua
ScriptShared.Items:Add("vehiclekeys", {
    stackable = false,
    deletable = true,
    tradable = true,
    label = "Vehicle Keys",
    weight = 0.1,
    category = "Raw Material",
    server = {
        export = "fivecode_carkeys:useKeys"
    }
})
```

</details>

5. Configure everything to your liking in [Config.lua](config-file).\

6.  Add the following into your database:

    ```sql
    CREATE TABLE IF NOT EXISTS `vehicle_keys` (
         `id` INT(11) NOT NULL AUTO_INCREMENT,
         `vehId` VARCHAR(50) NULL DEFAULT NULL COMMENT 'num or society (Universal key)' COLLATE 'utf8mb4_general_ci',
         `isActive` TINYINT(4) NOT NULL DEFAULT '1',
         `isStored` TINYINT(4) NOT NULL DEFAULT '0',
       PRIMARY KEY (`id`) USING BTREE
    );
    ```
7. Restart your inventory script and start fivecode\_carkeys, or restart your server.\

8. Enjoy the script!\

9. \[Optional] If you want to have item image in your inventory, place the image bellow here:\
   \- _`ox_inventory\web\images`_\
   \- _`qs-inventory\html\images`_\
   \- _`qb-inventory\html\images`_\
   \- _`aq-inventory\html\items`_

{% file src="https://3653526283-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0JI0UZcO9D2EyXo9ib4X%2Fuploads%2FkeF66DNw2q6pc2ZS7BwW%2Fvehiclekeys.png?alt=media&token=1869e2ce-603c-4cd0-a921-f52bae83f8fc" %}

> If you need help with anything else, do not hesitate and open a support ticket in our [discord](https://discord.gg/Yf7GrHDuUr).
