Consumables: Installation
Get the portion based food and drink system running on your server, with item definitions and images for ox_inventory and qb-inventory.
Before you start
Make sure OneSync is enabled and your server artifact is up to date. The script detects your framework, inventory, target and notification resource on its own and creates its only database table on the first start.
Requirements
| Resource | Required | Notes |
|---|---|---|
| ox_lib | Yes | Callbacks, key bindings and locales |
| oxmysql | Yes | Stores the food left on the ground |
| ox_inventory / ps-inventory / jpr-inventory / qb-inventory | Yes | One of them, detected in this order |
| qbx_core / qb-core / es_extended | Optional | Detected in this order, otherwise the script runs standalone |
| ox_target / qb-target | Optional | Needed to inspect and pick up food on the ground |
| okokNotify / ps-ui / ox_lib | Optional | Notifications, see Notifications in the config |
Inventory and framework combinations
qb style inventories (qb-inventory, ps-inventory, jpr-inventory) only run on qb-core. ESX and standalone servers
need ox_inventory. Without a supported inventory the resource stops with No supported inventory found.
See Dependencies for download links and the start order.
Setup
Download the resource
The script is free and open source (MIT). Get it from GitHub, see Free scripts.
Keep the folder name
The folder must be named hype-consumables. The ox_inventory item definitions call
hype-consumables.useFood, and the interface and exports resolve through this name.
The interface ships prebuilt in web/build. You only need Node.js if you want to change it (see the
FAQ).
Add the items
Apply only one of these, depending on your inventory. The item names must match the keys in config/foods.lua.
The 13 included items are burger, sandwich, hotdog, taco, fries, donut, chips, egobar, water,
sprunk, ecola, coffee and grapejuice.
Add the contents of INSTALL/ox_inventory.md (Lua item definitions) to the return { ... } table in
ox_inventory/data/items.lua. burger, sprunk, water, sandwich, coffee and grapejuice already exist
there: delete their current definitions and replace them with the ones from the file. Every item follows the same
shape:
['burger'] = {
label = 'Burger',
weight = 20,
stack = true,
close = true,
consume = 0,
description = 'Freshly made burger. Eaten bite by bite.',
client = {
export = 'hype-consumables.useFood',
},
buttons = {
{ label = 'Give to someone', action = function(slot) exports['hype-consumables']:giveFood(slot) end },
{ label = 'Put on the ground', action = function(slot) exports['hype-consumables']:dropFood(slot) end },
},
},| Field | Why |
|---|---|
weight | Packaging only. The remaining grams / ml are added through the metadata, so half a burger is lighter |
consume = 0 | ox_inventory does not remove the item itself, the script handles every bite |
client.export | Item use is handed to the script, framework consumable registrations are never reached |
buttons | Right click menu in the inventory: give to a player or put on the ground |
Copy INSTALL/item-images/*.png to ox_inventory/web/images/.
Both files also contain an optional spoiled_food item. Add it only if you set Spoilage.spoiledItem to
'spoiled_food' (see Spoilage).
Database
Nothing to do in most cases. On the first start the script creates its only table, hype_consumables_drops, which
keeps the food left on the ground across restarts. If your database user has no CREATE permission, run
INSTALL/install.sql by hand once:
CREATE TABLE IF NOT EXISTS `hype_consumables_drops` (
`id` VARCHAR(32) NOT NULL,
`item` VARCHAR(64) NOT NULL,
`metadata` LONGTEXT NOT NULL,
`x` FLOAT NOT NULL,
`y` FLOAT NOT NULL,
`z` FLOAT NOT NULL,
`heading` FLOAT NOT NULL DEFAULT 0,
`owner` VARCHAR(64) NULL DEFAULT NULL,
`created_at` INT NOT NULL,
PRIMARY KEY (`id`)
);Hunger, thirst, remaining amounts and expiry dates live in the item metadata and your framework, not in this table.
Start the resource
Add it to server.cfg after its dependencies, and set the language.
ensure ox_lib
ensure oxmysql
ensure qbx_core # or qb-core / es_extended (optional)
ensure ox_inventory # or qb-inventory / ps-inventory / jpr-inventory
ensure ox_target # or qb-target
# HypeScripts
ensure hype-consumables
setr ox:locale "en" # "en" and "tr" are includedSet the basics
The defaults work out of the box. Open config/config.lua to check the keys, spoil times and drop limits, and
config/foods.lua to tune the foods. See Configuration for every option.
Start order matters
If hype-consumables starts before your inventory, it prints No supported inventory found and stops. If it starts
before your framework, it falls back to standalone mode and hunger and thirst are not applied.
Verify
Set Debug = true in the config and start the server. Look for these lines in the console:
[DEBUG:SERVER] [INFO] Framework detected: qbx_core
[DEBUG:SERVER] [INFO] Inventory detected: ox_inventory
[hype-consumables] Loaded 0 food drops
[DEBUG:SERVER] [INFO] 13 foods loaded (framework: qbx_core)If an item is missing from your inventory, the console lists it: These foods are not registered in ox_inventory (see INSTALL): ...
Give yourself a burger and use it. The first bite is taken right away and a small panel opens in the bottom right
corner. Press E for more bites and watch the remaining grams go down in the panel and in the inventory.
Press X to put the rest away, then use the burger again: it continues where you left off. Press Q to put it on the
ground, then use Inspect and Pick up on it with your target.
With a second player next to you, press H while eating, then Y to send the offer. The other player accepts with Y.
When everything works, set Debug = false again.
How it works
- Bite by bite: a 200 g burger is eaten in 10 bites of 20 g. After 4 bites the inventory and the panel show 120 g. Bites are never taken automatically; every bite is one key press.
- Put away and continue: stop at any time. The rest stays in the inventory, and using the item again continues where you left off.
- Sealed and opened: new food is a sealed package. Sealed packages created together stack. The first bite opens the package, gives it a unique id and moves it to its own slot, so you need one free slot to start eating from a stack.
- Give to players: offer the food to a nearby player. The item is locked until the offer is answered and is moved on the server once accepted.
- Food on the ground: dropped food stays in the world as a prop, can be inspected and picked up, and survives server restarts.
- Real time spoilage: food spoils by category in real time, even while the server is off. Spoiled food is marked in the inventory and cannot be eaten by default.
- Hunger and thirst: every bite adds its share of hunger and thirst through your framework. A smaller last bite counts proportionally.
- Server side: every amount, expiry date and nutrition value is calculated on the server. The interface only displays them.
Controls
The panel uses no mouse or cursor; every action is a key and shown as a hint.
| Key | Action |
|---|---|
| Use the item | Start eating (the first bite is taken right away) |
E | Take a bite / sip (using the same item again does the same) |
Q | Put it on the ground |
X | Stop and put the rest away |
H | Give to someone: opens the nearby player list, again selects the next player |
Y / N | Send / cancel an offer, accept / decline an incoming one |
| Right click in inventory | Give / drop (ox_inventory only) |
| Target | Inspect / Pick up food on the ground |
The eating keys are GTA controls. While you eat or pick a player they are blocked every frame, so game actions on the
same key (cover, horn, headlights) cannot interfere; the rest of the time they belong to the game. Y and N are key
bindings that players can change under Settings → Key Bindings → FiveM.
Inventories
| ox_inventory | qb-inventory / ps-inventory / jpr-inventory | |
|---|---|---|
| Item use | client.export of the item definition | QBCore.Functions.CreateUseableItem |
| Metadata | Item metadata | Item info |
| Stacking | Sealed packages stack, opened food gets its own slot | Every food is unique |
| New items | Metadata is written right away by the createItem hook | Metadata is written on first use or when the player joins |
| Locks | Moving an offered item is blocked; moving the eaten food out of your inventory ends eating | No hooks; changes are caught when the offer is accepted or on the next bite |
| Extras | Remaining weight, percentage bar, right click give / drop buttons | Give / drop with the keys while eating |
Frameworks
| Framework | Hunger / thirst | Identifier |
|---|---|---|
qbx_core | Player state bag and metadata | citizenid |
qb-core | Metadata and hud:client:UpdateNeeds | citizenid |
es_extended | esx_status:add / esx_status:remove | identifier |
| Standalone | Server event hype-consumables:server:addStatus | license2 / license |
Standalone servers have no built-in hunger and thirst. Apply the values from your own status or HUD resource with the
hype-consumables:server:addStatus event.
Next steps
FAQ
Fixes for the most common HeroHunt App problems, from the app missing on the phone and heroes not spawning to catches, Candy and tasks.
Configuration
Every option in config/config.lua and config/foods.lua, from keys, bite timing and spoil times to giving food, ground drops and adding your own food.