Skip to content

Standalone mode — lumo-inventory ​

With no qb-core, qbx_core or es_extended running, lumo-inventory runs standalone. The console says ready — framework: standalone.

Who owns an inventory ​

  • With lumo-multicharacter (standalone): every character has its own inventory, keyed by its character id.
  • Without a character script: every player has one inventory, keyed by their Rockstar licence. It loads when FiveM's spawnmanager spawns them (or when lumo-spawn places them).

Items are stored in the lumo_inventories table, created on first start.

Items ​

The item list is shared/items.lua: about 330 items (food, drinks, medical, tools, weapons, ammo, attachments, backpacks, armor …) with pictures in html/images/. To add your own without editing that file, use Config.ExtraItems in config/config.lua:

lua
ExtraItems = {
    fishing_rod = { label = 'Fishing Rod', weight = 1500, image = 'fishing_rod.png',
                    unique = true, useable = true, description = 'Catch something.' },
},

Put the picture in html/images/fishing_rod.png.

Making an item usable ​

Food, drink, alcohol and healing items listed in Config.Consumables work out of the box. Weapons and ammo use the built-in weapon handler. For anything else, register what happens when the item is used, from any server script:

lua
exports['lumo-inventory']:CreateUsableItem('fishing_rod', function(source, item)
    -- item.slot, item.info (metadata) …
    TriggerClientEvent('myfishing:start', source)
end)

Giving and taking items from your scripts ​

lua
exports['lumo-inventory']:AddItem(source, 'water_bottle', 2)          -- false when full
exports['lumo-inventory']:AddItemOrDrop(source, 'water_bottle', 2)    -- full: dropped at their feet
exports['lumo-inventory']:RemoveItem(source, 'water_bottle', 1)
exports['lumo-inventory']:HasItem(source, 'water_bottle', 1)
exports['lumo-inventory']:GetItemCount(source, 'water_bottle')

More in Integration.

Money ​

There is no money without a framework. By default shops and vending machines are free (FreeShopping = true in bridge/config.lua). To charge, plug your own economy in:

lua
Standalone = {
    FreeShopping = false,
    Money = {
        GetMoney    = function(source, account) return exports.mybank:Get(source, account) end,
        RemoveMoney = function(source, account, amount, reason) return exports.mybank:Take(source, account, amount) end,
        AddMoney    = function(source, account, amount, reason) return exports.mybank:Give(source, account, amount) end,
    },
},

account is 'cash' or 'bank'. Each hook returns a number (GetMoney) or true/false. Any hook you set wins over FreeShopping.

Jobs ​

Job stashes and job-locked shops need a job. Return one from Standalone.GetJob:

lua
GetJob = function(source)
    local job = exports.myjobs:GetJob(source)   -- your own job script
    return job and { name = job.name, grade = { level = job.grade }, onduty = true } or nil
end,

Without it everyone is a civilian (unemployed).

Hunger, thirst and levels ​

Eating and drinking store hunger/thirst on the player's metadata and fire hud:client:UpdateNeeds, which most HUDs (lumo-ui, qb-hud …) read. Experience and levels are kept per character (lumo-multicharacter) or per licence. To feed your own needs system instead, set Config.Consumables.applyEffect = function(source, kind, amount) … end.

Admin commands ​

Admin commands check ACE groups:

cfg
add_principal identifier.license:YOUR_LICENSE group.admin
add_principal identifier.license:YOUR_LICENSE group.god     # /randomitems