Skip to content

Installation

Install pixel-consumables and register its items for your framework.

On this page7

Requirements

RequirementNotes
ox_libRequired on every server
pixel-utilsv1.1.0 or newer
1

Place the folder

Drag and drop pixel-consumables into your resources folder.

2

Add to server.cfg

You need to grant the necessary permissions for the UI to open and ensure the resource starts.

Navigate to your server.cfg and add the following lines preferably at the bottom of it:

code
# Admin permissions. One ace covers every Pixel resource.
add_ace group.admin pixel.admin allow

# Starting the resource.
ensure pixel-consumables

Make sure to ensure pixel-consumables after ox_lib, your framework and pixel-utils.

The command and keybind are Config.Command and Config.UIKey in Configuration, and both only re-register on a resource restart. /sethunger [server id or unique id] [0-100] and /setthirst are always runnable from the server console, ACE or not.

3

Register the items

Insert the items listed below for your respective framework. All 37 are listed. The names must match the keys in Config.ConsumablesCustom exactly, capitalisation included, because that is what the resource registers as usable.

Insert into qbcore/shared/items.lua

lua
-- Foods --
pixelsandwich = { name = 'pixelsandwich', label = 'Sandwich', weight = 200, type = 'item', image = 'pixelsandwich.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy food!' },
pixelbowlachilli = { name = 'pixelbowlachilli', label = 'Chilli Bowl', weight = 200, type = 'item', image = 'pixelbowlachilli.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy food!' },
pixelbowlapozole = { name = 'pixelbowlapozole', label = 'Pozole', weight = 200, type = 'item', image = 'pixelbowlapozole.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy food!' },
pixelburger = { name = 'pixelburger', label = 'Burger', weight = 200, type = 'item', image = 'pixelburger.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy food!' },
pixeltaco = { name = 'pixeltaco', label = 'Taco', weight = 200, type = 'item', image = 'pixeltaco.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy food!' },
 
-- Snacks --
pixelegochaserbar = { name = 'pixelegochaserbar', label = 'Egochaser', weight = 200, type = 'item', image = 'pixelegochaserbar.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy snack!' },
pixelmeteoritebar = { name = 'pixelmeteoritebar', label = 'Meteorite', weight = 200, type = 'item', image = 'pixelmeteoritebar.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy snack!' },
pixelearthquakebar = { name = 'pixelearthquakebar', label = 'Earthquake', weight = 200, type = 'item', image = 'pixelearthquakebar.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy snack!' },
 
-- Deserts --
pixelmuffin = { name = 'pixelmuffin', label = 'Muffin', weight = 200, type = 'item', image = 'pixelmuffin.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelcakeslice = { name = 'pixelcakeslice', label = 'Cake Slice', weight = 200, type = 'item', image = 'pixelcakeslice.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelcookie = { name = 'pixelcookie', label = 'Cookie', weight = 200, type = 'item', image = 'pixelcookie.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelchococookie = { name = 'pixelchococookie', label = 'Chocolate Cookie', weight = 200, type = 'item', image = 'pixelchococookie.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelchocodonut = { name = 'pixelchocodonut', label = 'Chocolate Donut', weight = 200, type = 'item', image = 'pixelchocodonut.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelstrawdonut = { name = 'pixelstrawdonut', label = 'Strawberry Donut', weight = 200, type = 'item', image = 'pixelstrawdonut.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelchocoicecone = { name = 'pixelchocoicecone', label = 'Chocolate Ice Cream', weight = 200, type = 'item', image = 'pixelchocoicecone.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelstrawicecone = { name = 'pixelstrawicecone', label = 'Strawberry Ice Cream', weight = 200, type = 'item', image = 'pixelstrawicecone.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
pixelvanillaicecone = { name = 'pixelvanillaicecone', label = 'Vanilla Ice Cream', weight = 200, type = 'item', image = 'pixelvanillaicecone.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Yummy dessert!' },
 
-- Drinks --
pixelcola = { name = 'pixelcola', label = 'Cola', weight = 200, type = 'item', image = 'pixelcola.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Tasty drink!' },
pixelsprunk = { name = 'pixelsprunk', label = 'Sprunk', weight = 200, type = 'item', image = 'pixelsprunk.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Tasty drink!' },
pixelorangotang = { name = 'pixelorangotang', label = 'OrangOTang', weight = 200, type = 'item', image = 'pixelorangotang.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Tasty drink!' },
pixeljunkenergy = { name = 'pixeljunkenergy', label = 'Junk Energy', weight = 200, type = 'item', image = 'pixeljunkenergy.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Tasty drink!' },
pixelcoffee = { name = 'pixelcoffee', label = 'Coffee', weight = 200, type = 'item', image = 'pixelcoffee.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Tasty drink!' },
pixelwater = { name = 'pixelwater', label = 'Water Bottle', weight = 200, type = 'item', image = 'pixelwater.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Tasty drink!' },
 
-- Alcohol --
pixelwhiskey = { name = 'pixelwhiskey', label = 'Whiskey', weight = 200, type = 'item', image = 'pixelwhiskey.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Lets get drunk!' },
pixelbeer = { name = 'pixelbeer', label = 'Beer', weight = 200, type = 'item', image = 'pixelbeer.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Lets get drunk!' },
pixelvodka = { name = 'pixelvodka', label = 'Vodka', weight = 200, type = 'item', image = 'pixelvodka.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Lets get drunk!' },
pixelchampagne = { name = 'pixelchampagne', label = 'Champagne', weight = 200, type = 'item', image = 'pixelchampagne.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Lets get drunk!' },
pixeltequilla = { name = 'pixeltequilla', label = 'Tequilla', weight = 200, type = 'item', image = 'pixeltequilla.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Lets get drunk!' },
pixelwine = { name = 'pixelwine', label = 'Wine', weight = 200, type = 'item', image = 'pixelwine.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Lets get drunk!' },
 
-- Drugs --
pixelcigs = { name = 'pixelcigs', label = 'Redwood Cigarettes', weight = 250, type = 'item', image = 'pixelcigs.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Pack of Cigarettes, Made in USA' },
pixelcigarette = { name = 'pixelcigarette', label = 'Cigarette', weight = 250, type = 'item', image = 'pixelcigarette.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Smokeable Tobacco' },
pixeljoint = { name = 'pixeljoint', label = 'Joint', weight = 0, type = 'item', image = 'pixeljoint.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'To chill out' },
pixelcocaine = { name = 'pixelcocaine', label = 'Cocaine', weight = 0, type = 'item', image = 'pixelcocaine.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'To chill out' },
pixelmeth = { name = 'pixelmeth', label = 'Meth', weight = 0, type = 'item', image = 'pixelmeth.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'To chill out' },
pixelshrooms = { name = 'pixelshrooms', label = 'Shrooms', weight = 0, type = 'item', image = 'pixelshrooms.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'To chill out' },
pixelecstasy = { name = 'pixelecstasy', label = 'Ecstasy', weight = 0, type = 'item', image = 'pixelecstasy.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'To chill out' },
pixeloxy = { name = 'pixeloxy', label = 'Oxy', weight = 0, type = 'item', image = 'pixeloxy.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'To chill out' },

Insert into ox_inventory/data/items.lua

lua
-- Foods
["pixelsandwich"] = {
    label = "Sandwich",
    weight = 200,
    stack = true,
    client = { image = "pixelsandwich.png" }
},
["pixelbowlachilli"] = {
    label = "Chilli Bowl",
    weight = 200,
    stack = true,
    client = { image = "pixelbowlachilli.png" }
},
["pixelbowlapozole"] = {
    label = "Pozole",
    weight = 200,
    stack = true,
    client = { image = "pixelbowlapozole.png" }
},
["pixelburger"] = {
    label = "Burger",
    weight = 200,
    stack = true,
    client = { image = "pixelburger.png" }
},
["pixeltaco"] = {
    label = "Taco",
    weight = 200,
    stack = true,
    client = { image = "pixeltaco.png" }
},
 
-- Snacks
["pixelegochaserbar"] = {
    label = "Egochaser",
    weight = 200,
    stack = true,
    client = { image = "pixelegochaserbar.png" }
},
["pixelmeteoritebar"] = {
    label = "Meteorite",
    weight = 200,
    stack = true,
    client = { image = "pixelmeteoritebar.png" }
},
["pixelearthquakebar"] = {
    label = "Earthquake",
    weight = 200,
    stack = true,
    client = { image = "pixelearthquakebar.png" }
},
 
-- Desserts
["pixelmuffin"] = {
    label = "Muffin",
    weight = 200,
    stack = true,
    client = { image = "pixelmuffin.png" }
},
["pixelcakeslice"] = {
    label = "Cake Slice",
    weight = 200,
    stack = true,
    client = { image = "pixelcakeslice.png" }
},
["pixelcookie"] = {
    label = "Cookie",
    weight = 200,
    stack = true,
    client = { image = "pixelcookie.png" }
},
["pixelchococookie"] = {
    label = "Chocolate Cookie",
    weight = 200,
    stack = true,
    client = { image = "pixelchococookie.png" }
},
["pixelchocodonut"] = {
    label = "Chocolate Donut",
    weight = 200,
    stack = true,
    client = { image = "pixelchocodonut.png" }
},
["pixelstrawdonut"] = {
    label = "Strawberry Donut",
    weight = 200,
    stack = true,
    client = { image = "pixelstrawdonut.png" }
},
["pixelchocoicecone"] = {
    label = "Chocolate Ice Cream",
    weight = 200,
    stack = true,
    client = { image = "pixelchocoicecone.png" }
},
["pixelstrawicecone"] = {
    label = "Strawberry Ice Cream",
    weight = 200,
    stack = true,
    client = { image = "pixelstrawicecone.png" }
},
["pixelvanillaicecone"] = {
    label = "Vanilla Ice Cream",
    weight = 200,
    stack = true,
    client = { image = "pixelvanillaicecone.png" }
},
 
-- Drinks
["pixelcola"] = {
    label = "Cola",
    weight = 200,
    stack = true,
    client = { image = "pixelcola.png" }
},
["pixelsprunk"] = {
    label = "Sprunk",
    weight = 200,
    stack = true,
    client = { image = "pixelsprunk.png" }
},
["pixelorangotang"] = {
    label = "OrangOTang",
    weight = 200,
    stack = true,
    client = { image = "pixelorangotang.png" }
},
["pixeljunkenergy"] = {
    label = "Junk Energy",
    weight = 200,
    stack = true,
    client = { image = "pixeljunkenergy.png" }
},
["pixelcoffee"] = {
    label = "Coffee",
    weight = 200,
    stack = true,
    client = { image = "pixelcoffee.png" }
},
["pixelwater"] = {
    label = "Water Bottle",
    weight = 200,
    stack = true,
    client = { image = "pixelwater.png" }
},
 
-- Alcohol
["pixelwhiskey"] = {
    label = "Whiskey",
    weight = 200,
    stack = true,
    client = { image = "pixelwhiskey.png" }
},
["pixelbeer"] = {
    label = "Beer",
    weight = 200,
    stack = true,
    client = { image = "pixelbeer.png" }
},
["pixelvodka"] = {
    label = "Vodka",
    weight = 200,
    stack = true,
    client = { image = "pixelvodka.png" }
},
["pixelchampagne"] = {
    label = "Champagne",
    weight = 200,
    stack = true,
    client = { image = "pixelchampagne.png" }
},
["pixeltequilla"] = {
    label = "Tequilla",
    weight = 200,
    stack = true,
    client = { image = "pixeltequilla.png" }
},
["pixelwine"] = {
    label = "Wine",
    weight = 200,
    stack = true,
    client = { image = "pixelwine.png" }
},
 
-- Drugs
["pixelcigs"] = {
    label = "Redwood Cigarettes",
    weight = 250,
    stack = true,
    client = { image = "pixelcigs.png" }
},
["pixelcigarette"] = {
    label = "Cigarette",
    weight = 250,
    stack = true,
    client = { image = "pixelcigarette.png" }
},
["pixeljoint"] = {
    label = "Joint",
    weight = 10,
    stack = true,
    client = { image = "pixeljoint.png" }
},
["pixelcocaine"] = {
    label = "Cocaine",
    weight = 10,
    stack = true,
    client = { image = "pixelcocaine.png" }
},
["pixelmeth"] = {
    label = "Meth",
    weight = 10,
    stack = true,
    client = { image = "pixelmeth.png" }
},
["pixelshrooms"] = {
    label = "Shrooms",
    weight = 10,
    stack = true,
    client = { image = "pixelshrooms.png" }
},
["pixelecstasy"] = {
    label = "Ecstasy",
    weight = 10,
    stack = true,
    client = { image = "pixelecstasy.png" }
},
["pixeloxy"] = {
    label = "Oxy",
    weight = 10,
    stack = true,
    client = { image = "pixeloxy.png" }
}

Execute the query below inside your database

sql
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
-- Food Items
('pixelsandwich', 'Sandwich', 250, 0, 1),
('pixelbowlachilli', 'Chilli Bowl', 350, 0, 1),
('pixelbowlapozole', 'Pozole', 350, 0, 1),
('pixelburger', 'Burger', 300, 0, 1),
('pixeltaco', 'Taco', 200, 0, 1),
 
-- Snacks
('pixelegochaserbar', 'Egochaser', 100, 0, 1),
('pixelmeteoritebar', 'Meteorite', 100, 0, 1),
('pixelearthquakebar', 'Earthquake', 100, 0, 1),
 
-- Desserts
('pixelmuffin', 'Muffin', 150, 0, 1),
('pixelcakeslice', 'Cake Slice', 200, 0, 1),
('pixelcookie', 'Cookie', 100, 0, 1),
('pixelchococookie', 'Chocolate Cookie', 120, 0, 1),
('pixelchocodonut', 'Chocolate Donut', 150, 0, 1),
('pixelstrawdonut', 'Strawberry Donut', 150, 0, 1),
('pixelchocoicecone', 'Chocolate Ice Cream', 250, 0, 1),
('pixelstrawicecone', 'Strawberry Ice Cream', 250, 0, 1),
('pixelvanillaicecone', 'Vanilla Ice Cream', 250, 0, 1),
 
-- Drinks
('pixelcola', 'Cola', 350, 0, 1),
('pixelsprunk', 'Sprunk', 350, 0, 1),
('pixelorangotang', 'OrangOTang', 350, 0, 1),
('pixeljunkenergy', 'Junk Energy', 400, 0, 1),
('pixelcoffee', 'Coffee', 200, 0, 1),
('pixelwater', 'Water Bottle', 500, 0, 1),
 
-- Alcohol
('pixelwhiskey', 'Whiskey', 800, 0, 1),
('pixelbeer', 'Beer', 400, 0, 1),
('pixelvodka', 'Vodka', 750, 0, 1),
('pixelchampagne', 'Champagne', 900, 0, 1),
('pixeltequilla', 'Tequilla', 750, 0, 1),
('pixelwine', 'Wine', 850, 0, 1),
 
-- Drugs
('pixelcigs', 'Redwood Cigarettes', 60, 1, 1),
('pixelcigarette', 'Cigarette', 20, 0, 1),
('pixeljoint', 'Joint', 10, 0, 1),
('pixelcocaine', 'Cocaine', 50, 0, 1),
('pixelmeth', 'Meth', 60, 0, 1),
('pixelshrooms', 'Shrooms', 30, 0, 1),
('pixelecstasy', 'Ecstasy', 30, 0, 1),
('pixeloxy', 'Oxy', 50, 0, 1);

The pixel-consumables does not create inventory items, it only makes items your inventory already has usable.

4

Add the item images

pixel-consumables/images holds 37 PNGs, one per item, each named after its item key. Copy them into your inventory's own image folder, such as ox_inventory/web/images or qb-inventory/html/images.

Item images included with pixel-consumables

The in-game editor's item cards reuse whichever path pixel-utils resolves for your inventory. Set Config.InventoryImagePath in pixel-utils/config.lua to a nui:// path where the %s is the item name. Left unresolved, the cards fall back to a category icon rather than a broken image.

If something goes wrong

Console lineCause
pixel-utils is not started. Consumables cannot work without it.pixel-utils is missing, stopped or errored on start. Nothing else in this resource runs
needs pixel-utils v1.1.0 or newer, found v…pixel-utils is older than the version this release calls into. Items stay unusable until it is updated
N of M items could not be registered as usableThe active inventory or framework cannot register usable items at runtime, which means no framework at all. Check the pixel-utils startup banner for what resolved
refusing to write config.lua - generated Lua does not compile: …An editor save was rejected. The old config.lua is still on disk untouched, and nothing you just edited was kept. This is the only sign a save failed
skipped a malformed config entry (key …, body …)One item in Config.ConsumablesCustom has a non-string key or a non-table body, so it was dropped from the file the editor wrote. Usually a hand edit
rejected config-editor request from unauthorised player …Someone without the pixel.admin ace triggered an editor event. Expected noise if a player is probing; check the name before granting anything
/set<need>: no connected player matches "…"The first argument matched neither a server id nor a unique id of anyone online
usage: /set<need> [server id or unique id] [0-100]The second argument was not a number
pixel-utils stopped mid-consume; released the Consuming latch.Client side. pixel-utils was stopped or restarted while that player was eating. That consume is abandoned, and the player can use items again straight away

Most other diagnostics only print while Config.Debug is true, including every refused consume. Turn it on before reporting an item that does nothing.

Updating

Two files are yours and ship unencrypted in every release:

  • config.lua
  • client/editable.lua

Copy both out before dropping in a new version, then move your changes back across. config.lua matters more here than in most resources: it is the only copy of your item set, and the in-game editor overwrites it in place with no backup of its own.

The resource version the update check compares against is read from fxmanifest.lua, so it follows the folder you installed rather than anything you configure. Turn the check off with Config.UpdateChecker = false.