Skip to main content

SetMetaData

Sets the metadata for an item found with the findBy options.

  • inv: number or string
  • findBy: table
    • name? string
    • itemHash? string
    • x? number
    • y? number
    • isWeared? boolean
    • meta? ItemMetaData
  • metaData: { [string]: any }

The inv argument can be a number (as player ID) or the inventory uniqueID.

Returns the updated InventoryItem.

exports["avp_grid_inventory"]:SetMetaData(inv, findBy, metaData)
Example
local source = source
local bodyArmourItem = exports["avp_grid_inventory"]:GetItemBy({ isWeared = true, name = "armour" })
if not bodyArmourItem then return end

bodyArmourItem.meta.durability = 100
bodyArmourItem.meta.drawable = 20

exports["avp_grid_inventory"]:SetMetaData(source, { itemHash = bodyArmourItem.itemHash }, bodyArmourItem.meta)