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
    • slot? number
    • quantity? number
    • 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_inv_4"]:SetMetaData(inv, findBy, metaData)
Example
local source = source
local bodyArmourItem = exports["avp_inv_4"]:GetItemBy({ name = "body_armour" })
if not bodyArmourItem then return end

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

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