View on GitHub

Usage

Documentation for Linden Inventory

Download this project as a .zip file Download this project as a tar.gz file
Links
Introduction
Common Issues
Usage
Snippets
Resources
Media
Discord

xPlayer functions

# Give player an item

  xPlayer.addInventoryItem(water, 1, {type='pee', description='it smells a little funky'})
  
  /giveitem [id] [item] [count] [metadata.type (single word)]

# Remove an item

  xPlayer.removeInventoryItem(water, 1, {type='pee', description='it smells a little funky'})
  
  /remove [id] [item] [count] [metadata.type (single word)]

# Get item data

  local metadata = {type='pee',description='it smells a little funky'}
  xPlayer.getInventoryItem(water, metadata)

# Retrieve item data from server

  ESX.TriggerServerCallback('linden_inventory:getItem',function(xItem)
    water = xItem
    print(xItem.count)
  end, 'water')

or

  ESX.TriggerServerCallback('linden_inventory:getItemCount',function(count)
    water = count
    print(count)
  end, 'water')

# Check item data

# Open a stash


# Creating new items

All your old items using ESX.RegisterUsableItem still work, however I would personally register items through the inventory

	['burger'] = {
		label = 'Burger',
		weight = 220,
		stack = true,
		close = true,
		client = {
			status = { hunger = 200000 },
			anim = { dict = 'mp_player_inteat@burger', clip = 'mp_player_int_eat_burger_fp' },
			prop = { model = 'prop_cs_burger_01', pos = { x = 0.02, y = 0.02, y = -0.02}, rot = { x = 0.0, y = 0.0, y = 0.0} },
			usetime = 2500,
			event = true,
		}
	},
AddEventHandler('linden_inventory:burger', function(item, wait, cb)
	cb(true)
	SetTimeout(wait, function()
		if not cancelled then
			TriggerEvent('mythic_notify:client:SendAlert', {type = 'inform', text = 'You ate a delicious burger', length = 2500})
		end
	end)
end)

# Custom drops