Installation

Requirements

Exports

Client Side Exports 
 -- Id Card
 exports['shx-idcard']:CreateCard('id_card')
 -- Police Badge
 exports['shx-idcard']:CreateCard('police_badge')
 -- EMS Badge
 exports['shx-idcard']:CreateCard('ems_badge')

Test Command

RegisterCommand("test982", function()
	exports['shx-idcard']:CreateCard('id_card')
	exports['shx-idcard']:CreateCard('police_badge')
	exports['shx-idcard']:CreateCard('ems_badge')
end)

Configuration

ESX or QBcore

shx-idcard/config.lua
Config = {}

Config.Framework = "qbcore" -- "qbcore" or "esx"
Config.Inventory = "qb_inventory" -- "qb_inventory" or "ox_inventory" or "qs_inventory"

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

function showNotification(msg)
    -- Example configurations:

    --  GTA (default)
    BeginTextCommandThefeedPost('STRING')
	AddTextComponentSubstringPlayerName(msg)
	EndTextCommandThefeedPostTicker(0,1)

    --  pNotify
    -- exports.pNotify:SendNotification({text = msg})
end 

INVENTORY

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:

ox_inventory\data\items.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
},

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:

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

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

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

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:

qb-inventory/js/app.js
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>"
);

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

qb-core/shared/items.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'},

qs-inventory

Add qs-inventory/config/config_metadata.js

qs-inventory/config/config_metadata.js
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>"
);

Go to qs-inventory/config/config_items.lua

qs-inventory/config/config_items.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',
},

Last updated

#21:

Change request updated