> filo_studios
Paid Resources🍔 filo_consumables

Installation

Item, admin access and the ox_inventory bridge.

Dependencies

ResourceRequiredUsed for
ox_libYesUI, callbacks, skill checks
oxmysqlYesStoring consumables
ox_inventoryYesThe consumable item
sleepless_promptsYesHold and share prompts
ox_targetYesTaking servings from shared boxes
qbx_core, qb-core or es_extendedOptionalHunger, thirst and stress

Setup

Put filo_consumables in your resources folder and ensure it after ox_lib, oxmysql, ox_inventory and sleepless_prompts.

Give your admins access to the panel:

add_ace group.admin filo_consumables.admin allow

Register the one item in ox_inventory/data/items.lua:

['filo_consumable'] = {
    label = 'Consumable',
    weight = 0,
    stack = true,
    close = true,
    consume = 0,
    server = { export = 'filo_consumables.useItem' },
},
Optional: apply the ox_inventory bridge (below) so other scripts can give consumables by name.
Set your server name, logo and colours in Config.Branding, then start the server. The table is created automatically, and three examples are added on the first start (Config.SeedExamples).

The panel's Integration tab shows whether the item and the bridge are in place.

How items are stored

Every consumable is the filo_consumable item with its own metadata:

MetadataShown by ox_inventory as
labelThe item name
descriptionThe description under it
imageurl / imageThe item image (a URL, or a file from your inventory:imagepath)
weightAdded on top of the base item weight (0)
durability + usesThe bar on multi-use items (bites or sips left)
consumableThe spawn name the script looks it up by

ox_inventory bridge

Without the bridge, exports.ox_inventory:AddItem(source, 'mac_n_cheese', 1) fails with invalid_item, and other scripts have to use the exports instead.

With it, every ox_inventory function that takes an item name also accepts a consumable's spawn name or label: server and client exports (AddItem, RemoveItem, SetItem, GetItemCount, Search and more), stashes and drops with starting items, and /giveitem, /removeitem and /setitem. A name is only resolved when it isn't a real item and the consumable exists, so everything else works as before.

To apply it:

  1. Copy filo_consumables/install/filoconsumables/shared.lua to ox_inventory/modules/filoconsumables/shared.lua.
  2. Make the small edits to ox_inventory's inventory, items and command files listed step by step in install/ox_inventory.md.
  3. Restart ox_inventory, then filo_consumables.

Redo this whenever you update ox_inventory.

Shops and crafting recipes are loaded from data files and need real items. Use name = 'filo_consumable' with metadata = exports.filo_consumables:GetMetadata('mac_n_cheese').

On this page