ox_inventory icon indicating copy to clipboard operation
ox_inventory copied to clipboard

feat: non-persistent inventory

Open m3ftwz opened this issue 1 year ago • 0 comments

I had a use case where I needed the inventory to be "session based" and not save anything to the database. (eg. pvp sessions with items, loot, etc...). I don't know if this makes any sense for you but it's been useful for me so I'm sharing.

I also added the option to set framework to 'none' in case a bridge is not needed.

This is how I'm initialising the inventory on my end:

RegisterNetEvent('someServerEventHandler', function()
    local Inventory = exports['ox_inventory']
    local license2 = GetPlayerIdentifierByType(source, 'license2'):gsub('license2:', '')
    local name = GetPlayerName(source)

    Inventory:setPlayerInventory({
        source = source,
        identifier = license2,
        name = name,
        --groups: {}
    });
end)

m3ftwz avatar Feb 25 '24 23:02 m3ftwz