Inventory items
Copy-paste item definitions for every supported inventory.
DashKart uses one inventory item: the DashKart tablet.
Setting (config/rider.lua → Config.Tablet) |
Default | Meaning |
|---|---|---|
item |
'dashkart_tablet' |
item name. If you rename it, rename it in the definitions below too. |
requireItem |
true |
F6 only opens the tablet when the player has the item. false = F6 works for everyone and no item is needed. |
giveOnClockIn |
true |
a rider without a tablet gets one when clocking in. |
enabled |
true |
false turns the tablet off; F6 then opens simple ox_lib menus. |
The admin panel (/dashkart admin) never needs the item.
What you do not need to define
- Catalog products (
dk_milk,dk_bread, … inconfig/catalog.lua). In V1 orders go to NPC customers, so products are stock numbers in the store and never enter a player’s inventory. - A delivery bag. The delivery bag on the rental scooter and the grocery bags in the rider’s hands are props, not items.
water/water_bottleare only used by the/dk_bridgetestdebug command, which adds and removes one again. Any item that already exists in your inventory works (Config.DebugTest.item).
Image
No icon ships with DashKart. Use any tablet icon you like: copy it into your inventory’s image folder as dashkart_tablet.png, or point the definition at an existing image such as tablet.png.
How using the item opens the tablet
- ox_inventory (QBox, and ESX / QBCore with ox_inventory): the item calls the export
dashkart.useTablet. The resource folder must be nameddashkart. - Every other inventory: DashKart registers the item as usable through your framework (
QBCore.Functions.CreateUseableItem,ESX.RegisterUsableItem, orRegisterUsableItemin the custom template). Mark the item usable and do not consume it.
ox_inventory (QBox, or any framework using ox_inventory)
ox_inventory/data/items.lua:
['dashkart_tablet'] = {
label = 'DashKart Tablet',
weight = 400,
stack = false,
close = true,
consume = 0,
description = 'Rider tablet: orders, live delivery map, earnings and store management.',
client = { image = 'dashkart_tablet.png' },
server = { export = 'dashkart.useTablet' },
},
Image folder: ox_inventory/web/images/. Restart ox_inventory (or the server) after editing.
QBCore with qb-inventory
qb-core/shared/items.lua:
dashkart_tablet = {
name = 'dashkart_tablet',
label = 'DashKart Tablet',
weight = 400,
type = 'item',
image = 'dashkart_tablet.png',
unique = true,
useable = true,
shouldClose = true,
description = 'Rider tablet: orders, live delivery map, earnings and store management.',
},
Image folder: qb-inventory/html/images/.
ESX (default ESX inventory)
Run once on your database:
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`)
VALUES ('dashkart_tablet', 'DashKart Tablet', 1, 0, 1)
ON DUPLICATE KEY UPDATE `label` = VALUES(`label`);
weight uses your ESX weight unit (ESX Legacy default: 1 unit per item). If you run ESX with ox_inventory, use the ox_inventory definition above instead.
qs-inventory
qs-inventory/shared/items.lua:
['dashkart_tablet'] = {
['name'] = 'dashkart_tablet',
['label'] = 'DashKart Tablet',
['weight'] = 400,
['type'] = 'item',
['image'] = 'dashkart_tablet.png',
['unique'] = true,
['useable'] = true,
['shouldClose'] = true,
['description'] = 'Rider tablet: orders, live delivery map, earnings and store management.',
},
Image folder: qs-inventory/html/images/.
codem-inventory
Add to codem-inventory’s item list (codem-inventory/config/itemlist.lua in current versions):
['dashkart_tablet'] = {
name = 'dashkart_tablet',
label = 'DashKart Tablet',
weight = 400,
type = 'item',
image = 'dashkart_tablet.png',
unique = true,
useable = true,
shouldClose = true,
description = 'Rider tablet: orders, live delivery map, earnings and store management.',
},
Copy the image into codem-inventory’s item image folder.
core_inventory
core_inventory uses your framework’s item list. Add the item exactly as shown for QBCore (qb-core/shared/items.lua) or ESX (SQL above), and copy the image into core_inventory’s image folder. If your core_inventory version keeps its own item list, use the same name, label and weight there and mark it usable.
Custom framework / other inventories
Add an item named dashkart_tablet that is unique (non-stacking is fine), usable and not consumed on use. Then either:
- implement
Framework.RegisterUsableIteminbridge/framework/custom.lua(DashKart calls it with the item name), or - if your inventory triggers server exports on use, call
exports.dashkart:useTablet('usingItem', nil, { id = source }).
If you run no supported inventory, item checks go through Framework.NativeInventory in the custom template (see docs/CUSTOM_FRAMEWORK.md).
Checking it works
- Clock in at a DashKart store without a tablet: you should receive one and see a notification telling you to press F6.
- Use the item or press F6: the tablet opens.
- If the server console shows
Could not give "dashkart_tablet" to <id> - is the item defined in your inventory?, the item definition is missing or has a different name.