Voucher
You can skip if you are not going to use the voucher
1. Creating item
To use the voucher, you need to have it has item.
You can simply do it adding it to your inventory shared items or to your sql (it depends on your inventory).
Here you have some pre-made implementations
You can change the description as you want, Its currently on portuguese.
ESX - SQL
INSERT INTO `items` (name, label, weight, rare, can_remove) VALUES
('voucher','Voucher - 35.000€', 0, 1, 0)
;
QB Core
['voucher'] = {['name'] = 'voucher', ['label'] = 'Voucher PDM', ['weight'] = 0, ['type'] = 'item', ['image'] = 'voucher.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Voucher valor: 35.000€, Este artigo é pessoal e não pode ser vendido ou repassado.'},
You can use any name for the item, just make sure you use the same name on your items file and on Config.ItemVoucher
2. Item when player is created
In order to give the item to the player when he creates a new character you will need to change the core files of your server.
Here you have all the steps to do it according to your framework.
ESX
QB Core
You need to go to qb-core/shared/main.lua and add the following line to QBShared.StarterItems
['voucher'] = { amount = 1, item = 'voucher'}
So it will look like this
QBShared.StarterItems = {
['phone'] = { amount = 1, item = 'phone' },
['id_card'] = { amount = 1, item = 'id_card' },
['driver_license'] = { amount = 1, item = 'driver_license' },
['voucher'] = { amount = 1, item = 'voucher'}
}
Now its full set, every time a new player joins your server he will receive a Voucher to buy any vehicle he wants with the same or less price you set up in config.
Last updated
Was this helpful?