Keys as Items

Enable this feature in config.lua

Run Keyfobs.sql or the following query into your database

CREATE TABLE IF NOT EXISTS `mk_keyfobs` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`owner` VARCHAR(50) NULL DEFAULT NULL,
	`plate` VARCHAR(50) NULL DEFAULT NULL,
	`fakeplate` VARCHAR(50) NULL DEFAULT NULL,
	`model` VARCHAR(50) NULL DEFAULT NULL,
	`fobid` VARCHAR(50) NULL DEFAULT NULL,
	`old_fobs` LONGTEXT NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE,
	INDEX `owner` (`owner`) USING BTREE,
	INDEX `plate` (`plate`) USING BTREE,
	INDEX `fobnumber` (`fobid`) USING BTREE,
	INDEX `Column 6` (`old_fobs`(1024)) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

Framework Setup

Add carkey item to qb-core/shared/items.lua

['carkey'] 				 		 = {['name'] = 'carkey', 			  	  		['label'] = 'Vehicle Keys', 			['weight'] = 100, 		['type'] = 'item', 		['image'] = 'carkey.png', 				['unique'] = true, 		['useable'] = true, 	['shouldClose'] = true,   ['combinable'] = nil,   	['description'] = 'Vehicle Key Fob'},

Inventory Setup

Add carkey item metadata

  • Open file qb-inventory/html/js/app.js

  • Locate function FormatItemInfo(itemData)

  • Insert the following else if statement

else if (itemData.name == "carkey") {
    $(".item-info-title").html('<p>'+itemData.label+'</p>')
    $(".item-info-description").html("<p><strong>Brand: </strong>" + itemData.info.brand + "</p><p><strong>Name: </strong>" + itemData.info.name + "</p><p><strong>Vehicle ID: </strong>" + itemData.info.id + "</p><p><strong>Plate: </strong>" + itemData.info.plate + "</p>");
}

Example of finished insert:

Add carkey image

  • add the following image (or your own) to qb-inventory/html/images/

Last updated