Skip to content

Inventory

This page documents hooks in the inventory category.


BagInventoryReady(item, inventory)View Source

Purpose

Called after a bag item finishes creating or restoring its nested inventory.

Category

Inventory

Realm

Server

Parameters

table item The bag item that owns the nested inventory.

table inventory The nested bag inventory that is now ready.

Example Usage

  hook.Add("BagInventoryReady", "liaExampleBagInventoryReady", function(item, inventory)
      print("[MyModule] handled BagInventoryReady")
  end)

BagInventoryRemoved(item, inventory)View Source

Purpose

Called when a bag item's nested inventory is removed.

Category

Inventory

Realm

Server

Parameters

table item The bag item losing its nested inventory.

table inventory The nested inventory being removed.

Example Usage

  hook.Add("BagInventoryRemoved", "liaExampleBagInventoryRemoved", function(item, inventory)
      print("[MyModule] handled BagInventoryRemoved")
  end)

CanItemBeTransfered(item, curInv, inventory, client)View Source

Purpose

Determines whether an item transfer between inventories should be allowed before the move is completed.

Category

Inventory

Realm

Server

Parameters

Item item The item being transferred.

Inventory curInv The source inventory that currently owns the item.

Inventory inventory The destination inventory for the transfer.

Player client optional The player initiating the transfer, when available.

Returns

boolean|nil Return false to block the transfer. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanItemBeTransfered", "liaExampleTransferCheck", function(item, curInv, inventory, client)
      if item and item.lockedToInventory then return false end
  end)

CanOpenBagPanel(item)View Source

Purpose

Determines whether a bag inventory panel should be opened alongside the main weight inventory.

Category

Inventory

Realm

Client

Parameters

Item item The bag item whose inventory panel is being considered.

Returns

boolean|nil Return false to suppress opening the bag panel. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanOpenBagPanel", "liaExampleCanOpenBagPanel", function(item)
      if item.uniqueID == "hiddenbag" then
          return false
      end
  end)

CanPlayerDropItem(client, item)View Source

Purpose

Determines whether a player may drop an item through the standard item interaction flow.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting to drop the item.

Item item The item being dropped.

Returns

boolean|nil Return false to block the drop action. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPlayerDropItem", "liaExampleCanPlayerDropItem", function(client, item)
      if item.uniqueID == "radio" then
          return false
      end
  end)

CanPlayerEquipItem(client, item)View Source

Purpose

Determines whether a player may equip an item through the standard item interaction flow.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting to equip the item.

Item item The item being equipped.

Returns

boolean|nil Return false to block the equip action. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPlayerEquipItem", "liaExampleCanPlayerEquipItem", function(client, item)
      if item.uniqueID == "heavyarmor" and client:Crouching() then
          return false
      end
  end)

CanPlayerInteractItem(client, action, item, data)View Source

Purpose

Determines whether a player may run an item interaction through the standard item action flow.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting the item interaction.

string action The lowercased action identifier such as `drop`, `take`, `equip`, `unequip`, or `combine`.

Item item The item being interacted with.

table data optional Optional extra action data forwarded by the caller, such as combine context.

Returns

boolean|string|nil Return false to block the interaction. A second return value may provide the failure reason used by callers. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPlayerInteractItem", "liaExampleCanPlayerInteractItem", function(client, action, item, data)
      if action == "drop" and item.uniqueID == "radio" then
          return false, L("forbiddenActionStorage")
      end
  end)

CanPlayerRotateItem(client, item)View Source

Purpose

Determines whether a player may rotate an item through the standard item interaction flow.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting to rotate the item.

Item item The item being rotated.

Returns

boolean|nil Return false to block item rotation. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPlayerRotateItem", "liaExampleCanPlayerRotateItem", function(client, item)
      if item.isBag then
          return false
      end
  end)

CanPlayerSpawnStorage(client, entity, info)View Source

Purpose

Determines whether a player may convert an entity into storage.

Category

Inventory

Realm

Server

Parameters

Player client The player trying to create the storage entity.

Entity entity The target entity being turned into storage.

table info The requested storage configuration data.

Returns

boolean|nil Return false to block storage creation.

Example Usage

  hook.Add("CanPlayerSpawnStorage", "liaExampleCanPlayerSpawnStorage", function(client, entity, info)
      if IsValid(client) and client:IsAdmin() then
          return true
      end
  end)

CanPlayerTakeItem(client, item)View Source

Purpose

Determines whether a player may take an item through the standard item interaction flow.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting to take the item.

Item item The item being taken.

Returns

boolean|nil Return false to block the take action. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPlayerTakeItem", "liaExampleCanPlayerTakeItem", function(client, item)
      if client:getNetVar("jailed") then
          return false
      end
  end)

CanPlayerUnequipItem(client, item)View Source

Purpose

Determines whether a player may unequip an item through the standard item interaction flow.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting to unequip the item.

Item item The item being unequipped.

Returns

boolean|nil Return false to block the unequip action. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPlayerUnequipItem", "liaExampleCanPlayerUnequipItem", function(client, item)
      if client:getNetVar("restricted") then
          return false
      end
  end)

CanPlayerViewInventory()View Source

Purpose

Determines whether the inventory menu button should be available for the local player.

Category

Inventory

Realm

Client

Returns

boolean|nil Return false to hide the inventory menu button. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPlayerViewInventory", "liaExampleCanPlayerViewInventory", function()
      if IsValid(lia.gui.character) then
          return false
      end
  end)

CanRunItemAction(tempItem, key)View Source

Purpose

Determines whether a specific item action should be included in the entity interaction menu.

Category

Inventory

Realm

Client

Parameters

table tempItem The temporary item table prepared for menu action checks.

string key The item function key being evaluated.

Returns

boolean|nil Return false to suppress the item action. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanRunItemAction", "liaExampleCanRunItemAction", function(tempItem, key)
      if key == "drop" and tempItem.player:Crouching() then
          return false
      end
  end)

CanSaveData(ent, inventory)View Source

Purpose

Determines whether a storage entity's inventory data should be persisted.

Category

Inventory

Realm

Server

Parameters

Entity ent The storage entity being saved.

table inventory The inventory attached to the storage entity.

Returns

boolean|nil Return false to skip saving this storage inventory.

Example Usage

  hook.Add("CanSaveData", "liaExampleCanSaveData", function(ent, inventory)
      return true
  end)

CanTakeEntity(client, targetEntity, itemUniqueID)View Source

Purpose

Determines whether the convert-entity keybind may turn a traced world entity into an inventory item.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting the conversion.

Entity targetEntity The traced entity that would be removed and converted.

string itemUniqueID The item unique ID mapped from the entity class.

Returns

boolean|nil Return false to block the conversion. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanTakeEntity", "liaExampleCanTakeEntity", function(client, targetEntity, itemUniqueID)
      if targetEntity:IsOnFire() then
          return false
      end
  end)

CreateInventoryPanel(inventory, parent)View Source

Purpose

Allows the clientside inventory interface to be created for a specific inventory.

Category

Inventory

Realm

Client

Parameters

table inventory The inventory instance that needs a panel.

Panel parent optional Optional parent panel for the created inventory panel.

Returns

Panel The created inventory panel.

Example Usage

  hook.Add("CreateInventoryPanel", "liaExampleCreateInventoryPanel", function(inventory, parent)
      print("[MyModule] handled CreateInventoryPanel")
  end)

GetDefaultInventorySize(client, char)View Source

Purpose

Allows modules to override the default dimensions assigned to a character inventory. For weight inventories, this changes the inventory panel width and height only. Use GetInventoryMaxWeight to override the carry weight limit.

Category

Inventory

Realm

Server

Parameters

Player client The player whose character inventory is being sized.

Character char The character whose inventory dimensions are being resolved.

Returns

number|nil, number|nil Return width and height values to override the configured defaults. In weight inventories, these values affect the UI dimensions rather than max carry weight. Returning nil values allows the normal inventory size config to continue.

Example Usage

  hook.Add("GetDefaultInventorySize", "liaExampleGetDefaultInventorySize", function(client, char)
      if char and char:getFaction() == FACTION_STAFF then
          return 8, 5
      end
  end)

GetDefaultInventoryType(character)View Source

Purpose

Allows modules to override which inventory type new characters should receive by default.

Category

Inventory

Realm

Server

Parameters

Character character optional The character being initialized, when available.

Returns

string|nil Return an inventory type identifier to override the default inventory type. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("GetDefaultInventoryType", "liaExampleInventoryType", function(character)
      return "GridInv"
  end)

GetInventoryMaxWeight(inventory, maxWeight)View Source

Purpose

Allows code to override the computed maximum carry weight for a weight inventory.

Category

Inventory

Realm

Shared

Parameters

table inventory The inventory whose maximum weight is being calculated.

number maxWeight The default maximum weight before overrides are applied.

Returns

number|nil Return a replacement max weight to override the default value.

Example Usage

  hook.Add("GetInventoryMaxWeight", "liaExampleGetInventoryMaxWeight", function(inventory, maxWeight)
      return (maxWeight or 0) + 5
  end)

InitializeStorage(entity)View Source

Purpose

Called when the storage system initializes a storage-capable entity.

Category

Inventory

Realm

Shared

Parameters

Entity entity The storage entity being initialized.

Example Usage

  hook.Add("InitializeStorage", "liaExampleInitializeStorage", function(entity)
      print("[MyModule] handled InitializeStorage")
  end)

InterceptClickItemIcon(panel, itemIcon, keyCode)View Source

Purpose

Allows clientside code to intercept clicks on a grid inventory item icon before default handling runs.

Category

Inventory

Realm

Client

Parameters

Panel panel The grid inventory panel receiving the click.

Panel itemIcon The clicked item icon panel.

number keyCode The mouse key or button code that was pressed.

Returns

boolean|nil Return true to indicate the click was fully handled and skip default processing.

Example Usage

  hook.Add("InterceptClickItemIcon", "liaExampleInterceptClickItemIcon", function(panel, itemIcon, keyCode)
      return true
  end)

InventoryClosed(panel, inventory)View Source

Purpose

Called when an inventory panel is removed or closed.

Category

Inventory

Realm

Client

Parameters

Panel panel The inventory panel that was closed.

table inventory The inventory instance that was displayed by the panel.

Returns

Example Usage

  hook.Add("InventoryClosed", "liaExampleInventoryClosed", function(panel, inventory)
      if not IsValid(panel) then return end
      panel:SetTooltip("InventoryClosed handled by MyModule")
  end)

InventoryDataChanged(instance, key, oldValue, value)View Source

Purpose

Runs after an inventory data field has been updated from a network message.

Category

Inventory

Realm

Client

Parameters

Inventory instance The inventory instance whose data changed.

string key The inventory data key that was updated.

any oldValue The previous stored value.

any value The new value assigned to the inventory.

Example Usage

  hook.Add("InventoryDataChanged", "liaExampleInventoryDataChanged", function(instance, key, oldValue, value)
      print("[Inventory] Data changed:", key)
  end)

InventoryDeleted(instance)View Source

Purpose

Runs immediately before a clientside inventory instance is removed from the inventory cache.

Category

Inventory

Realm

Client

Parameters

Inventory instance The inventory instance that is being deleted.

Example Usage

  hook.Add("InventoryDeleted", "liaExampleInventoryDeleted", function(instance)
      print("[Inventory] Deleted:", instance:getID())
  end)

InventoryInitialized(instance)View Source

Purpose

Runs after a clientside inventory instance and all of its current items have been initialized.

Category

Inventory

Realm

Client

Parameters

Inventory instance The inventory instance that was initialized.

Example Usage

  hook.Add("InventoryInitialized", "liaExampleInventoryInitialized", function(instance)
      print("[Inventory] Ready:", instance:getID())
  end)

InventoryItemAdded(inventory, item)View Source

Purpose

Runs after an initialized item instance is inserted into a clientside inventory cache.

Category

Inventory

Realm

Client

Parameters

Inventory inventory The inventory instance that received the item.

Item item The item instance that was added to the inventory.

Example Usage

  hook.Add("InventoryItemAdded", "liaExampleInventoryItemAdded", function(inventory, item)
      print("[Inventory] Added", item.uniqueID, "to", inventory:getID())
  end)

InventoryItemIconCreated(icon, item, panel)View Source

Purpose

Called after a grid inventory item icon panel is created.

Category

Inventory

Realm

Client

Parameters

Panel icon The newly created item icon panel.

table item The inventory item represented by the icon.

Panel panel The parent grid inventory panel.

Example Usage

  hook.Add("InventoryItemIconCreated", "liaExampleInventoryItemIconCreated", function(icon, item, panel)
      if not IsValid(panel) then return end
      panel:SetTooltip("InventoryItemIconCreated handled by MyModule")
  end)

InventoryItemRemoved(inventory, item)View Source

Purpose

Runs after an item instance is removed from a clientside inventory cache through inventory sync or item deletion.

Category

Inventory

Realm

Client

Parameters

Inventory inventory The inventory instance the item was removed from.

Item item The item instance that was removed.

Example Usage

  hook.Add("InventoryItemRemoved", "liaExampleInventoryItemRemoved", function(inventory, item)
      print("[Inventory] Removed", item.uniqueID, "from", inventory:getID())
  end)

InventoryOpened(panel, inventory)View Source

Purpose

Called after an inventory panel has been created and opened.

Category

Inventory

Realm

Client

Parameters

Panel panel The inventory panel that was opened.

table inventory The inventory instance displayed by the panel.

Returns

Example Usage

  hook.Add("InventoryOpened", "liaExampleInventoryOpened", function(panel, inventory)
      if not IsValid(panel) then return end
      panel:SetTooltip("InventoryOpened handled by MyModule")
  end)

InventoryPanelCreated(panel, inventory, parent)View Source

Purpose

Called after a grid inventory panel is created.

Category

Inventory

Realm

Client

Parameters

Panel panel The created inventory panel.

table inventory The inventory assigned to the panel.

Panel parent optional The parent panel, if one was provided.

Example Usage

  hook.Add("InventoryPanelCreated", "liaExampleInventoryPanelCreated", function(panel, inventory, parent)
      if not IsValid(panel) then return end
      panel:SetTooltip("InventoryPanelCreated handled by MyModule")
  end)

IsSuitableForTrunk(ent)View Source

Purpose

Allows modules to decide whether an entity should be treated as a valid trunk-capable storage target.

Category

Inventory

Realm

Shared

Parameters

Entity ent The entity being checked for trunk storage support.

Returns

boolean|nil Return true to mark the entity as trunk-capable or false to reject it. Returning nil allows the default vehicle and storage checks to continue.

Example Usage

  hook.Add("IsSuitableForTrunk", "liaExampleIsSuitableForTrunk", function(ent)
      if IsValid(ent) and ent:GetClass() == "prop_vehicle_jeep" then
          return true
      end
  end)

ItemCombine(client, item, target)View Source

Purpose

Allows code to handle combining one item with another before default transfer behavior continues.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting the combine action.

table item The item being moved or used.

table target The item being combined with.

Returns

boolean|nil Return true when the combine action was handled successfully.

Example Usage

  hook.Add("ItemCombine", "liaExampleItemCombine", function(client, item, target)
      if IsValid(client) and client:IsAdmin() then
          return true
      end
  end)

ItemDataChanged(item, key, oldValue, newValue)View Source

Purpose

Runs after a clientside item data field has been updated from a networked item data sync.

Category

Inventory

Realm

Client

Parameters

Item item The item instance whose data changed.

string key The item data key that was updated.

any oldValue The previous stored value for the item data key.

any newValue The new value assigned to the item data key.

Example Usage

  hook.Add("ItemDataChanged", "liaExampleItemDataChanged", function(item, key, oldValue, newValue)
      print("[Item] Data changed:", item.uniqueID, key)
  end)

ItemDeleted(instance)View Source

Purpose

Runs after a clientside item instance has been removed from its inventory and instance cache.

Category

Inventory

Realm

Client

Parameters

Item instance The item instance that was deleted.

Example Usage

  hook.Add("ItemDeleted", "liaExampleItemDeleted", function(instance)
      if instance then
          print("[Inventory] Deleted item:", instance.uniqueID)
      end
  end)

ItemDraggedOutOfInventory(client, item)View Source

Purpose

Runs when a player drags an item out of an inventory UI and no destination inventory is provided.

Category

Inventory

Realm

Server

Parameters

Player client The player dragging the item out of the inventory.

Item item The item being dragged out.

Returns

any Returns the first non-nil value from registered hook handlers.

Example Usage

  hook.Add("ItemDraggedOutOfInventory", "liaExampleItemDraggedOutOfInventory", function(client, item)
      if IsValid(client) then
          return item:interact("drop", client)
      end
  end)

ItemInitialized(item)View Source

Purpose

Runs after a clientside item instance has been created or refreshed from networked item data.

Category

Inventory

Realm

Client

Parameters

Item item The item instance that was initialized.

Example Usage

  hook.Add("ItemInitialized", "liaExampleItemInitialized", function(item)
      print("[Inventory] Initialized item:", item.uniqueID)
  end)

ItemPaintOver(panel, itemTable, w, h)View Source

Purpose

Runs after an item icon panel finishes its normal paint pass so modules can draw extra overlays.

Category

Inventory

Realm

Client

Parameters

Panel panel The item icon panel being painted.

Item itemTable optional The item instance assigned to the panel, when available.

number w The width of the item panel.

number h The height of the item panel.

Example Usage

  hook.Add("ItemPaintOver", "liaExampleItemPaintOver", function(panel, itemTable, w, h)
      if itemTable and itemTable:getData("favorite") then
          draw.SimpleText("*", "DermaDefaultBold", w - 8, 4, color_white, TEXT_ALIGN_RIGHT)
      end
  end)

ItemQuantityChanged(item, oldValue, quantity)View Source

Purpose

Runs after a stackable item quantity has been updated from the server.

Category

Inventory

Realm

Client

Parameters

Item item The item whose quantity changed.

number oldValue The previous quantity.

number quantity The new quantity.

Example Usage

  hook.Add("ItemQuantityChanged", "liaExampleItemQuantityChanged", function(item, oldValue, quantity)
      print("[Inventory] Quantity changed:", oldValue, quantity)
  end)

ItemShowEntityMenu(entity)View Source

Purpose

Runs when the local player opens the entity interaction menu for a world item.

Category

Inventory

Realm

Client

Parameters

Entity entity The item entity that triggered the menu.

Example Usage

  hook.Add("ItemShowEntityMenu", "liaExampleItemShowEntityMenu", function(entity)
      if entity:isItem() then
          surface.PlaySound("buttons/button14.wav")
      end
  end)

ItemTransfered(context)View Source

Purpose

Runs after an item transfer between inventories succeeds.

Category

Inventory

Realm

Server

Parameters

table context A transfer context table containing `client`, `item`, `from`, and `to`.

Example Usage

  hook.Add("ItemTransfered", "liaExampleItemTransfered", function(context)
      print("Transferred item", context.item:getName())
  end)

OnCreateDualInventoryPanels(panel1, panel2, inventory1, inventory2)View Source

Purpose

Called after two inventory panels have been created and positioned for a dual-inventory view.

Category

Inventory

Realm

Client

Parameters

Panel panel1 The panel displaying the first inventory.

Panel panel2 The panel displaying the second inventory.

table inventory1 The first inventory instance.

table inventory2 The second inventory instance.

Returns

Example Usage

  hook.Add("OnCreateDualInventoryPanels", "liaExampleOnCreateDualInventoryPanels", function(panel1, panel2, inventory1, inventory2)
      print("[MyModule] handled OnCreateDualInventoryPanels")
  end)

OnCreateItemInteractionMenu(panel, menu, itemTable)View Source

Purpose

Runs before the default item interaction options are added so modules can customize or replace the context menu.

Category

Inventory

Realm

Client

Parameters

Panel panel The item icon panel that opened the menu.

Panel menu The newly created derma menu instance.

Item itemTable The item whose interaction menu is being built.

Returns

boolean|nil Return true to stop the default menu population. Returning nil allows the standard item actions to be added.

Example Usage

  hook.Add("OnCreateItemInteractionMenu", "liaExampleOnCreateItemInteractionMenu", function(panel, menu, itemTable)
      if itemTable.uniqueID == "badge" then
          menu:AddOption("Inspect Badge", function() print(itemTable:getName()) end)
          return true
      end
  end)

OnCreateStoragePanel(localInvPanel, storageInvPanel, storage)View Source

Purpose

Called after the client creates the paired inventory panels for a storage UI.

Category

Inventory

Realm

Client

Parameters

Panel localInvPanel The local player's inventory panel.

Panel storageInvPanel The storage inventory panel.

Entity storage The storage entity being viewed.

Example Usage

  hook.Add("OnCreateStoragePanel", "liaExampleOnCreateStoragePanel", function(localInvPanel, storageInvPanel, storage)
      print("[MyModule] handled OnCreateStoragePanel")
  end)

OnItemAdded(owner, item)View Source

Purpose

Runs after an item has been added to an inventory and replicated so modules can react to the ownership change.

Category

Inventory

Realm

Server

Parameters

Player|Entity owner optional The owner returned by the item when it is added, when available.

Item item The item instance that was added to the inventory.

Example Usage

  hook.Add("OnItemAdded", "liaExampleOnItemAdded", function(owner, item)
      if item then
          print("Added item:", item:getName())
      end
  end)

OnPlayerLostStackItem(itemTypeOrItem)View Source

Purpose

Called when the grid inventory stack restore flow fails to recover an item.

Category

Inventory

Realm

Server

Parameters

string|table itemTypeOrItem The item type or item reference that could not be restored.

Example Usage

  hook.Add("OnPlayerLostStackItem", "liaExampleOnPlayerLostStackItem", function(itemTypeOrItem)
      print("[MyModule] handled OnPlayerLostStackItem")
  end)

OnRequestItemTransfer(panel, itemID, inventoryID, x, y)View Source

Purpose

Called on the client when a grid inventory panel requests an item transfer.

Category

Inventory

Realm

Client

Parameters

Panel panel The panel that initiated the transfer request.

number itemID The item ID being transferred.

number inventoryID optional The target inventory ID, if applicable.

number x The requested destination X slot.

number y The requested destination Y slot.

Example Usage

  hook.Add("OnRequestItemTransfer", "liaExampleOnRequestItemTransfer", function(panel, itemID, inventoryID, x, y)
      if not IsValid(panel) then return end
      panel:SetTooltip("OnRequestItemTransfer handled by MyModule")
  end)

PostDrawInventory(mainPanel, parentPanel)View Source

Purpose

Runs after the weight inventory panels have been laid out and VGUI finished rendering for the frame.

Category

Inventory

Realm

Client

Parameters

Panel mainPanel The primary inventory panel created for the player's inventory.

Panel parentPanel The parent panel that hosted the inventory layout.

Example Usage

  hook.Add("PostDrawInventory", "liaExamplePostDrawInventory", function(mainPanel, parentPanel)
      surface.SetDrawColor(255, 255, 255, 10)
  end)

SetupBagInventoryAccessRules(inventory)View Source

Purpose

Allows code to configure access rules on a newly created bag inventory.

Category

Inventory

Realm

Server

Parameters

table inventory The bag inventory being initialized.

Example Usage

  hook.Add("SetupBagInventoryAccessRules", "liaExampleSetupBagInventoryAccessRules", function(inventory)
      print("[MyModule] handled SetupBagInventoryAccessRules")
  end)

StorageCanTransferItem(client, storage, item)View Source

Purpose

Determines whether a player may transfer a specific item through a storage interaction.

Category

Inventory

Realm

Server

Parameters

Player client The player attempting the transfer.

Entity storage The storage entity involved in the transfer.

table item The item being moved.

Returns

boolean|nil Return false to block the item transfer.

Example Usage

  hook.Add("StorageCanTransferItem", "liaExampleStorageCanTransferItem", function(client, storage, item)
      if IsValid(client) and client:IsAdmin() then
          return true
      end
  end)

StorageEntityRemoved(entity, inventory)View Source

Purpose

Called when a storage entity is removed and its attached inventory is being cleaned up.

Category

Inventory

Realm

Server

Parameters

Entity entity The storage entity being removed.

table inventory The inventory attached to the entity.

Example Usage

  hook.Add("StorageEntityRemoved", "liaExampleStorageEntityRemoved", function(entity, inventory)
      print("[MyModule] handled StorageEntityRemoved")
  end)

StorageInventorySet(entity, inventory, isCar)View Source

Purpose

Called after a storage entity is assigned an inventory.

Category

Inventory

Realm

Shared

Parameters

Entity entity The storage entity receiving the inventory.

table inventory The inventory assigned to the entity.

boolean isCar Whether the storage entity is a vehicle trunk.

Example Usage

  hook.Add("StorageInventorySet", "liaExampleStorageInventorySet", function(entity, inventory, isCar)
      print("[MyModule] handled StorageInventorySet")
  end)

StorageOpen(storage)View Source

Purpose

Runs when a weight-inventory storage container should open its clientside storage panel.

Category

Inventory

Realm

Client

Parameters

Inventory storage The storage inventory being opened.

Example Usage

  hook.Add("StorageOpen", "liaExampleStorageOpenWeightInv", function(storage)
      print("Opened storage", storage:getID())
  end)

StorageRestored(ent, inventory)View Source

Purpose

Called after persisted storage data is restored onto an entity.

Category

Inventory

Realm

Server

Parameters

Entity ent The storage entity that was restored.

table inventory The restored inventory.

Example Usage

  hook.Add("StorageRestored", "liaExampleStorageRestored", function(ent, inventory)
      print("[MyModule] handled StorageRestored")
  end)

StorageUnlockPrompt(entity)View Source

Purpose

Called on the client when a storage unlock prompt should be shown.

Category

Inventory

Realm

Client

Parameters

Entity entity The locked storage entity requesting unlock input.

Example Usage

  hook.Add("StorageUnlockPrompt", "liaExampleStorageUnlockPrompt", function(entity)
      print("[MyModule] handled StorageUnlockPrompt")
  end)