Server

Items

exports['ak47_inventory']:Items()

AddItem

exports['ak47_inventory']:AddItem(inv, item, amount, slot, info, weight, expiretime)
  • inv: string or number

    • player id or unique inventory identifier

  • item: string

    • item name

  • amount: number

    • amount of the item

  • slot: number (optional)

    • slot value

  • info: table (optional)

    • item metadata table

  • weight: number (optional)

    • change the weight of this item

  • expiretime: number (optional)

    • change expire time of this item

RemoveItem

  • inv: string or number

    • player id or unique inventory identifier

  • item: string

    • item name

  • amount: number

    • amount of the item

  • slot: number (optional)

    • slot value

GetItem

  • inv: string or number

  • item: string

    • item name

  • info?: table (optional)

  • strict?: boolean (optional)

    • full match or partial match

Return: table

  • item table with total item amount & properties

GetFirstItem

  • inv: string or number

  • item: string

    • item name

Return: table

  • first item table with total item amount & properties

CanAddItem

  • identifier: string or number

    • player id or inventory identifier

  • item string

    • item name

  • amount: number

  • skipWeight?: boolean (optional)

    • if true then it will not check weight. Only check if there is any slot available

Return: boolean

CanCarryAmount

  • identifier: string or number

    • player id or inventory identifier

  • item string

    • item name

Return: number

CanCarryWeight

  • identifier: string or number

    • player id or inventory identifier

  • weight:number

Return: boolean, number

  • canHold

  • availableWeight

SetMaxWeight

  • identifier: string or number

    • player id or inventory identifier

  • newWeight:number

CanSwapItem

Returns true if the item swap is possible based on inventory weight.

  • inv: string or number

  • firstItem: string

  • firstItemAmount: number

  • testItem: string

  • testItemAmount: number

Return: boolean

GetAmount

  • identifier: string or number

  • item: string

    • item name

  • info?: table (optional)

  • strict?: boolean (optional)

    • full match or partial match

Return: number

GetSlot

  • identifier: string or number

  • slot: number

Return: table

  • item table of that slot

GetSlotForItem

  • identifier: string or number

  • itemName: string

  • info: table?

Return: number

  • slotId

GetSlotIdWithItem

  • identifier: string or number

  • itemName: string

  • info?: table

  • strict?: boolean

    • strictly match info properties, otherwise use partial matching.

Return: number

  • slotId

GetSlotIdsWithItem

  • identifier: string or number

  • itemName: string

  • info?: table

  • strict?: boolean

    • Strictly match info properties, otherwise use partial matching.

Return: table

  • slotIds:

GetSlotsWithItem

  • identifier: string or number

  • itemName: string

  • info?: table

  • strict?: boolean

    • Strictly match info properties, otherwise use partial matching.

Return: table

  • slotsData

GetEmptySlot

  • identifier: string or number

Return: number

  • slotId

GetContainerFromSlot

  • identifier: string or number

  • slotId: number

Return: table

  • containerData

SetSlotCount

  • identifier: string or number

  • slots: number

GetInventory

  • identifier: string or number

Return: table

  • inventoryTable

GetInventoryItems

  • identifier: string or number

Return: table

  • inventoryItemsTable

SetInvItems

  • identifier: string or number

  • items: table

ConfiscateInventory

  • identifier: string or number

ReturnInventory

  • identifier: string or number

ClearInventory

  • identifier: string or number

ClearClothing

  • identifier: string or number

  • identifier: string or number

  • search: string

  • item: table or string

  • info?: table or string

search can be either 'slots' or 'count', where slots will return a table of data and count will return the found amount of the specified item.

CreateInventory

  • identifier: string

  • data: table

    • label: string

    • maxWeight: number

    • slots: number

    • type: string

      • backpack, stash, player, shop, trunk, glovebox

    • type2: string or nil

      • smallBackpack, largeBackpack (only use for backpack)

    • temp: boolean or nil

      • is this a temporary inventory?

    • whitelist: table or nil

      • list of whitelisted items or nil

    • blacklist: table or nil

      • list of blacklisted items or nil

Example:

LoadInventory

load an existing inventory from databse

Return: boolean

Example:

UnloadInventory

  • identifier: string or number

SetWhitelistedItemsForContainer

  • identifier: string or number

  • items: table

Example:

SetBlacklistedItemsForContainer

  • identifier: string or number

  • items: table

Example:

GetCurrentWeapon

  • identifier: string or number

Return: table

  • currentWeapon

SetQuality

  • identifier: string or number

  • slot: number

  • quality: number

SetItemInfo

  • identifier: string or number

  • slot: number

  • info: table

RemoveQuality

  • identifier: string or number

  • slot: number

  • value: number

SaveInventory

  • identifier: string or number

DeleteInventory

  • identifier: string or number

SaveAllInventory

OnChangeVehiclePlate

  • oldPlate: string

  • newPlate: string

Last updated