📦Installation

How to install and setup

Step 1 - Place resource in [qb] folder

Place the folder qb-pos inside your folder with all the other qb scripts. This is most likely called [qb]

Step 2 - Database

Execute the following code in your database

CREATE TABLE IF NOT EXISTS `player_vehicles` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `license` varchar(50) DEFAULT NULL,
    `citizenid` varchar(50) DEFAULT NULL,
    `vehicle` varchar(50) DEFAULT NULL,
    `hash` varchar(50) DEFAULT NULL,
    `mods` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
    `plate` varchar(15) NOT NULL,
    `fakeplate` varchar(50) DEFAULT NULL,
    `garage` varchar(50) DEFAULT 'pillboxgarage',
    `fuel` int(11) DEFAULT 100,
    `engine` float DEFAULT 1000,
    `body` float DEFAULT 1000,
    `state` int(11) DEFAULT 1,
    `depotprice` int(11) NOT NULL DEFAULT 0,
    `drivingdistance` int(50) DEFAULT NULL,
    `status` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `plate` (`plate`),
    KEY `citizenid` (`citizenid`),
    KEY `license` (`license`)
) ENGINE=InnoDB AUTO_INCREMENT=1;

ALTER TABLE `player_vehicles`
ADD UNIQUE INDEX UK_playervehicles_plate (plate);

ALTER TABLE `player_vehicles`
ADD CONSTRAINT FK_playervehicles_players FOREIGN KEY (citizenid)
REFERENCES `players` (citizenid) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `player_vehicles`
ADD COLUMN `balance` int(11) NOT NULL DEFAULT 0;
ALTER TABLE `player_vehicles`
ADD COLUMN `paymentamount` int(11) NOT NULL DEFAULT 0;
ALTER TABLE `player_vehicles`
ADD COLUMN `paymentsleft` int(11) NOT NULL DEFAULT 0;
ALTER TABLE `player_vehicles`
ADD COLUMN `financetime` int(11) NOT NULL DEFAULT 0;

DROP TABLE IF EXISTS `vehicle_log`;

CREATE TABLE `vehicle_log` (
  `shop` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `id` int(11) NOT NULL,
  `sellerCitizenid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sellerName` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `buyerCitizenid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `buyerName` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `brand` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `plate` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehiclePrice` int(11) NOT NULL,
  `sellerCommission` int(11) NOT NULL,
  `dealerCommission` int(11) NOT NULL,
  `downPayment` int(11) NOT NULL,
  `term` int(11) NOT NULL,
  `date` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `time` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `import` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `vehicle_log`
  ADD PRIMARY KEY (`id`);
ALTER TABLE `vehicle_log`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;

DROP TABLE IF EXISTS `imports`;

CREATE TABLE `imports` (
  `shop` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `brand` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `stock` int(11) NOT NULL,
  `available` int(11) NOT NULL DEFAULT 1,
  `date` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `imports`
  ADD PRIMARY KEY (`model`);

CREATE TABLE `vehicle_repo` (
  `shop` varchar(255) NOT NULL,
  `brand` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `model` varchar(255) NOT NULL,
  `plate` varchar(255) NOT NULL,
  `playerName` varchar(255) NOT NULL,
  `playerCID` varchar(255) NOT NULL,
  `date` varchar(255) NOT NULL,
  `time` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `vehicle_repo`
  ADD PRIMARY KEY (`shop`);

Step 3 - Add Items

Add the following items into your qb-core items.lua file:

["dealer-tablet"] 						= {["name"] = "dealer-tablet",  	     	["label"] = "Dealer Tablet",	 		["weight"] = 250, 		["type"] = "item", 		["image"] = "tablet.png", 				["unique"] = true, 	["useable"] = true, 	["shouldClose"] = true,   	["combinable"] = nil,   ["description"] = "Car dealer management tablet", ['created'] = nil, ['decay'] = 28.0},

Step 4 - Adding vehicles

To add a vehicle to a shop, look at the example below:

['lp570'] = {
	['name'] = 'Gallardo',
	['brand'] = 'Lamborghini',
	['model'] = 'lp570',
	['price'] = 24000,
	['category'] = 'import', -- Change the category to 'import' for any vehicle that is an import, otherwise make the category normal like: sports
	['hash'] = 'lp570',
	['shop'] = 'pdm', -- shop must be the same as the one in config
},

category and shop are the two line you need to configure for your vehicles. Typically, the vehicles file is located in qb-core/shared/vehicles.lua

Step 5 - Import Vehicles

Any vehicle that is an import must also be setup in the database as well. Open up your database and look for the newly created table called imports. This is where you will add the vehicles.

Step 6 - Configuration

Tweak the configuration file to your liking.

Last updated