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
CREATETABLEIFNOTEXISTS`player_vehicles` (`id`int(11) NOT NULL AUTO_INCREMENT,`license`varchar(50) DEFAULTNULL,`citizenid`varchar(50) DEFAULTNULL,`vehicle`varchar(50) DEFAULTNULL,`hash`varchar(50) DEFAULTNULL,`mods`textCHARACTERSET utf8mb4 COLLATE utf8mb4_bin DEFAULTNULL,`plate`varchar(15) NOT NULL,`fakeplate`varchar(50) DEFAULTNULL,`garage`varchar(50) DEFAULT'pillboxgarage',`fuel`int(11) DEFAULT100,`engine`floatDEFAULT1000,`body`floatDEFAULT1000,`state`int(11) DEFAULT1,`depotprice`int(11) NOT NULLDEFAULT0,`drivingdistance`int(50) DEFAULTNULL,`status`textDEFAULTNULL,PRIMARY KEY (`id`),KEY`plate` (`plate`),KEY`citizenid` (`citizenid`),KEY`license` (`license`)) ENGINE=InnoDB AUTO_INCREMENT=1;ALTERTABLE`player_vehicles`ADDUNIQUEINDEX UK_playervehicles_plate (plate);ALTERTABLE`player_vehicles`ADDCONSTRAINT FK_playervehicles_players FOREIGN KEY (citizenid)REFERENCES`players` (citizenid) ON DELETE CASCADEONUPDATE CASCADE;ALTERTABLE`player_vehicles`ADD COLUMN `balance`int(11) NOT NULLDEFAULT0;ALTERTABLE`player_vehicles`ADD COLUMN `paymentamount`int(11) NOT NULLDEFAULT0;ALTERTABLE`player_vehicles`ADD COLUMN `paymentsleft`int(11) NOT NULLDEFAULT0;ALTERTABLE`player_vehicles`ADD COLUMN `financetime`int(11) NOT NULLDEFAULT0;DROPTABLEIFEXISTS`vehicle_log`;CREATETABLE `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 DEFAULTNULL,`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 NULLDEFAULT'',`time`varchar(255) COLLATE utf8mb4_unicode_ci NOT NULLDEFAULT'',`import`int(11) NOT NULLDEFAULT0) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;ALTERTABLE`vehicle_log`ADDPRIMARY KEY (`id`);ALTERTABLE`vehicle_log`MODIFY`id`int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;DROPTABLEIFEXISTS`imports`;CREATETABLE `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 NULLDEFAULT1,`date`varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;ALTERTABLE`imports`ADDPRIMARY KEY (`model`);CREATETABLE `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;ALTERTABLE`vehicle_repo`ADDPRIMARY KEY (`shop`);
Step 3 - Add Items
Add the following items into your qb-core items.lua file:
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.