# Installation

## Requirements <a href="#requirements" id="requirements"></a>

* [MugshotBase64](https://github.com/BaziForYou/MugShotBase64)

## Exports

{% code title="Exports" fullWidth="false" %}

```lua
exports['shx-idcard']:CreateCard('id_card')
exports['shx-idcard']:CreateCard('driver_license')
exports['shx-idcard']:CreateCard('weapon_license')
exports['shx-idcard']:CreateCard('police_badge')
exports['shx-idcard']:CreateCard('ems_badge')

```

{% endcode %}

## Test Command <a href="#configuration" id="configuration"></a>

<pre class="language-lua"><code class="lang-lua">RegisterCommand("test982", function()
    exports['shx-idcard']:CreateCard('id_card')
    exports['shx-idcard']:CreateCard('driver_license')
    exports['shx-idcard']:CreateCard('weapon_license')
<strong>    exports['shx-idcard']:CreateCard('police_badge')
</strong><strong>    exports['shx-idcard']:CreateCard('ems_badge')
</strong>end)
</code></pre>

## Configuration <a href="#configuration" id="configuration"></a>

#### ESX or QBcore <a href="#esx" id="esx"></a>

{% code title="shx-idcard/config.lua" %}

```lua
Config = {}

Config.Framework    = "qbox"         -- "qbcore" or "esx" or "qbox"
Config.Inventory    = "ox_inventory" -- "qb_inventory" or "qs_inventory" or "ox_inventory"
Config.UseTarget    = "ox_target"    -- "qb_target" or "ox_target" or "q_target"

Config.oxlibRequire = true           -- ox_lib support true or false
Config.MenuType     = "ox_lib"       -- ox_lib = support true |  qb_menu = qb-menu supoort

Config.PedShow      = true           -- Ped Show true or false hidden
Config.PedLocation  = vector4(-545.24, -203.87, 38.22, 207.5) -- Ped Location and Target Location
Config.PedModel     = "a_m_y_stwhi_01" -- Ped Model

Config.LicenseList = {
    { event = 'shx-idcard:client:buyIDCard',          label = 'ID Card',        price = 100,  image = "https://cdn.discordapp.com/attachments/247367407864119306/1153712058618105936/id_card.png",           qbmenuicon = "fa-solid fa-handcuffs"},
    { event = 'shx-idcard:client:buyWeaponLicense',   label = 'Weapon License', price = 1000, image = "https://cdn.discordapp.com/attachments/247367407864119306/1153712057162682541/weaponlicense.png",     qbmenuicon = "fa-solid fa-handcuffs"},
    { event = 'shx-idcard:client:buyDriverLicense',   label = 'Driver License', price = 1000, image = "https://cdn.discordapp.com/attachments/247367407864119306/1153712057573703801/driverlicense.png",     qbmenuicon = "fa-solid fa-handcuffs"},
    { event = 'shx-idcard:client:buyPDBadge',         label = 'PD Badge',       price = 500,  job = "police",    image = 'https://cdn.discordapp.com/attachments/247367407864119306/1153712059079458826/pdbadge.png',           qbmenuicon = "fa-solid fa-handcuffs"},
    { event = 'shx-idcard:client:buyEMSBadge',        label = 'EMS Badge',      price = 500,  job = "ambulance", image = 'https://cdn.discordapp.com/attachments/247367407864119306/1153712058135748628/ems_badge_empty.png',   qbmenuicon = "fa-solid fa-handcuffs"},
}

Config.Target = { -- Target Icon and Label
    MenuTarget  = {label = 'Talk',   icon = 'fa-regular fa-comment-dots'},
}

Config.Genders = {
    male = "Male", -- Male
    female = "Female" -- Female
}
```

{% endcode %}

## INVENTORY

{% hint style="danger" %}
**Note :**  /giveitem ID id\_card 1

Don't use giveitem for cards, use this instead
{% endhint %}

### ox\_inventory

You also need to add the item to ox\_inventory. To do this, navigate to `ox_inventory/data/items.lua` and modify it to look like this:

{% code title="ox\_inventory\data\items.lua" %}

```lua
['id_card'] = {
   label = 'ID Card',
   weight = 1,
   close = true,
   stack = false,
   consume = 0
},
	   
['police_badge'] = {
 label = 'Police Badge',
 weight = 1,
 close = true,
 stack = false,
 consume = 0
},
	   
['ems_badge'] = {
 label = 'EMS Badge',
 weight = 1,
 close = true,
 stack = false,
 consume = 0
},
	   
['driver_license'] = {
 label = 'Driver License',
 weight = 1,
 close = true,
 stack = false,
 consume = 0
},

['weaponlicense'] = {
 label = 'Weapon License',
 weight = 1,
 close = true,
 stack = false,
 consume = 0
},
```

{% endcode %}

You also need to add the item usable to ox\_inventory. To do this, navigate to `ox_inventory/modules/items/client.lua` and modify it to look like this:

{% code title="ox\_inventory\modules\items\client.lua" %}

```lua
Item('id_card', function(data, slot)
    TriggerEvent('shx-idcard:client:showId', slot.metadata)
end)

Item('police_badge', function(data, slot)
    TriggerEvent('shx-idcard:client:showPoliceBadge', slot.metadata)
end)

Item('ems_badge', function(data, slot)
    TriggerEvent('shx-idcard:client:showEMSBadge', slot.metadata)
end)

Item('driver_license', function(data, slot)
    TriggerEvent('shx-idcard:client:showDriverLicense', slot.metadata)
end)

Item('weaponlicense', function(data, slot)
    TriggerEvent('shx-idcard:client:showWeaponLicense', slot.metadata)
end)
```

{% endcode %}

### qb\_inventory

Go to `qb-inventory/js/app.js` and find the function `function FormatItemInfo(itemData) {`, by default at line 384. After `if (itemData != null && itemData.info != "") {`, add the following code:

{% code title="qb-inventory/js/app.js" %}

```javascript
if (itemData.name == "id_card") {
   $(".item-info-title").html("<p>" + itemData.label + "</p>");
   $(".item-info-description").html(
      "</span></p><p><strong>Firstname: </strong><span>" +
      itemData.info.firstname +
      "</span></p><p><strong>Lastname: </strong><span>" +
      itemData.info.lastname +
      "</span></p><p><strong>Date Of Birth: </strong><span>" +
      itemData.info.birthdate +
      "</span></p><p><strong>Gender: </strong><span>" +
      gender +
      "</span></p>"
);
   } else if (itemData.name == "ems_badge") {
       $(".item-info-title").html("<p>" + itemData.label + "</p>");
       $(".item-info-description").html(
       "<p><strong>Firstname: </strong><span>" +
       itemData.info.firstname +
       "</span></p><p><strong>Lastname: </strong><span>" +
       itemData.info.lastname +
       "</span></p>"
);
   } else if (itemData.name == "police_badge") {
       $(".item-info-title").html("<p>" + itemData.label + "</p>");
       $(".item-info-description").html(
       "<p><strong>Firstname: </strong><span>" +
       itemData.info.firstname +
       "</span></p><p><strong>Lastname: </strong><span>" +
       itemData.info.lastname +
       "</span></p>"
);
 } else if (itemData.name == "driver_license") {
   $(".item-info-title").html("<p>" + itemData.label + "</p>");
   $(".item-info-description").html(
      "</span></p><p><strong>Firstname: </strong><span>" +
      itemData.info.firstname +
      "</span></p><p><strong>Lastname: </strong><span>" +
      itemData.info.lastname +
      "</span></p><p><strong>Date Of Birth: </strong><span>" +
      itemData.info.birthdate +
      "</span></p><p><strong>Gender: </strong><span>" +
      gender +
      "</span></p>"
);
 } else if (itemData.name == "weaponlicense") {
   $(".item-info-title").html("<p>" + itemData.label + "</p>");
   $(".item-info-description").html(
      "</span></p><p><strong>Firstname: </strong><span>" +
      itemData.info.firstname +
      "</span></p><p><strong>Lastname: </strong><span>" +
      itemData.info.lastname +
      "</span></p><p><strong>Date Of Birth: </strong><span>" +
      itemData.info.birthdate +
      "</span></p><p><strong>Gender: </strong><span>" +
      gender +
      "</span></p>"
);
```

{% endcode %}

Go to `qb-core/shared/items.lua`, add the following code:

{% code title="qb-core/shared/items.lua" %}

```lua
['id_card'] 			 	 	 = {['name'] = 'id_card', 			  		['label'] = 'ID Card', 			        ['weight'] = 100, 		['type'] = 'item', 		['image'] = 'id_card.png', 			['unique'] = true, 		['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = 'ID Card'},
['police_badge'] 			 	 = {['name'] = 'police_badge', 			  	        ['label'] = 'Police Badge', 			['weight'] = 100, 		['type'] = 'item', 		['image'] = 'police_badge.png', 		['unique'] = true, 		['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = 'Police Badge'},
['ems_badge'] 			 	         = {['name'] = 'ems_badge', 			  		['label'] = 'EMS Badge', 			['weight'] = 100, 		['type'] = 'item', 		['image'] = 'ems_badge.png', 			['unique'] = true, 		['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = 'EMS Badge'},
['driver_license'] 			 	 = {['name'] = 'driver_license', 			  	['label'] = 'Driver License', 			['weight'] = 100, 		['type'] = 'item', 		['image'] = 'ems_badge.png', 			['unique'] = true, 		['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = 'Weapon License'},
['weaponlicense'] 			 	 = {['name'] = 'weaponlicense', 			  	['label'] = 'Weapon License', 			['weight'] = 100, 		['type'] = 'item', 		['image'] = 'ems_badge.png', 			['unique'] = true, 		['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = 'Driver License'},
```

{% endcode %}

### qs-inventory

Add qs-inventory/config/config\_metadata.js

{% code title="qs-inventory/config/config\_metadata.js" %}

```javascript
if (itemData.name == "id_card") {
   $(".item-info-title").html("<p>" + itemData.label + "</p>");
   $(".item-info-description").html(
      "</span></p><p><strong>Firstname: </strong><span>" +
      itemData.info.firstname +
      "</span></p><p><strong>Lastname: </strong><span>" +
      itemData.info.lastname +
      "</span></p><p><strong>Date Of Birth: </strong><span>" +
      itemData.info.birthdate +
      "</span></p><p><strong>Gender: </strong><span>" +
      gender +
      "</span></p>"
);
   } else if (itemData.name == "ems_badge") {
       $(".item-info-title").html("<p>" + itemData.label + "</p>");
       $(".item-info-description").html(
       "<p><strong>Firstname: </strong><span>" +
       itemData.info.firstname +
       "</span></p><p><strong>Lastname: </strong><span>" +
       itemData.info.lastname +
       "</span></p>"
);
   } else if (itemData.name == "police_badge") {
       $(".item-info-title").html("<p>" + itemData.label + "</p>");
       $(".item-info-description").html(
       "<p><strong>Firstname: </strong><span>" +
       itemData.info.firstname +
       "</span></p><p><strong>Lastname: </strong><span>" +
       itemData.info.lastname +
       "</span></p>"
);
 } else if (itemData.name == "driver_license") {
   $(".item-info-title").html("<p>" + itemData.label + "</p>");
   $(".item-info-description").html(
      "</span></p><p><strong>Firstname: </strong><span>" +
      itemData.info.firstname +
      "</span></p><p><strong>Lastname: </strong><span>" +
      itemData.info.lastname +
      "</span></p><p><strong>Date Of Birth: </strong><span>" +
      itemData.info.birthdate +
      "</span></p><p><strong>Gender: </strong><span>" +
      gender +
      "</span></p>"
);
 } else if (itemData.name == "weaponlicense") {
   $(".item-info-title").html("<p>" + itemData.label + "</p>");
   $(".item-info-description").html(
      "</span></p><p><strong>Firstname: </strong><span>" +
      itemData.info.firstname +
      "</span></p><p><strong>Lastname: </strong><span>" +
      itemData.info.lastname +
      "</span></p><p><strong>Date Of Birth: </strong><span>" +
      itemData.info.birthdate +
      "</span></p><p><strong>Gender: </strong><span>" +
      gender +
      "</span></p>"
);
```

{% endcode %}

Go to qs-inventory/config/config\_items.lua

{% code title="qs-inventory/config/config\_items.lua" %}

```lua
['police_badge'] =  {
    ['name'] =  'police_badge',
    ['label'] =  'Police Badge',
    ['weight'] =  200,
    ['type'] =  'item',
    ['image'] =  'police_badge.png',
    ['unique'] =  true,
    ['useable'] =  true,
    ['shouldClose'] =  true,
    ['combinable'] =  nil,
    ['description'] =  'Badge',
},
['id_card'] =  {
    ['name'] =  'id_card',
    ['label'] =  'ID Card',
    ['weight'] =  200,
    ['type'] =  'item',
    ['image'] =  'id_card.png',
    ['unique'] =  true,
    ['useable'] =  true,
    ['shouldClose'] =  true,
    ['combinable'] =  nil,
    ['description'] =  'ID Card',
},
['ems_badge'] =  {
    ['name'] =  'ems_badge',
    ['label'] =  'EMS Badge',
    ['weight'] =  200,
    ['type'] =  'item',
    ['image'] =  'ems_badge.png',
    ['unique'] =  true,
    ['useable'] =  true,
    ['shouldClose'] =  true,
    ['combinable'] =  nil,
    ['description'] =  'Badge',
},
['weaponlicense'] =  {
    ['name'] =  'weaponlicense',
    ['label'] =  'Weapon License',
    ['weight'] =  200,
    ['type'] =  'item',
    ['image'] =  'weaponlicense.png',
    ['unique'] =  true,
    ['useable'] =  true,
    ['shouldClose'] =  true,
    ['combinable'] =  nil,
    ['description'] =  'Badge',
},
['driver_license'] =  {
    ['name'] =  'driver_license',
    ['label'] =  'Driver License',
    ['weight'] =  200,
    ['type'] =  'item',
    ['image'] =  'driver_license.png',
    ['unique'] =  true,
    ['useable'] =  true,
    ['shouldClose'] =  true,
    ['combinable'] =  nil,
    ['description'] =  'Badge',
},
```

{% endcode %}


---

# 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://shx-store.gitbook.io/shxstore/scripts/shx-idcard/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.
