Storage

Hook Documentation for Inventory Module.

Functions

MODULE:CanPlayerSpawnStorage(client, entity, data)

Whether or not a player is allowed to spawn a container entity.

Parameters

  • client Player

    The player attempting to spawn a container.

  • entity Entity

    The container entity being spawned.

  • data Table

    Additional data related to the container being spawned.

Returns

  • bool

    Whether or not to allow the player to spawn the container.

Example Usage

function MODULE:CanPlayerSpawnStorage(client, entity, data)
    return client:isStaff() -- Restrict spawning containers to staff.
end

MODULE:CanSaveData(entity, inventory)

Determines whether data associated with a storage entity should be saved. This hook allows customization of conditions for saving data associated with a storage entity.

Parameters

  • entity Entity

    The storage entity.

  • inventory Entity

    The inventory associated with the storage entity.

Returns

  • bool

    Whether the data should be saved.

MODULE:OnCreateStoragePanel(localInvPanel, storageInvPanel, storage)

Called when a storage panel is created. This hook is triggered when a panel for displaying storage inventory is created.

Parameters

  • localInvPanel Panel

    The panel displaying the local inventory.

  • storageInvPanel Panel

    The panel displaying the storage inventory.

  • storage Entity

    The storage entity.

MODULE:StorageCanTransferItem(client, storage, item)

Determines whether a player is allowed to transfer an item to a storage entity. This hook allows customization of permissions for transferring items to a storage entity.

Parameters

  • client Player

    The player attempting to transfer the item.

  • storage Entity

    The storage entity.

  • item

    The item being transferred.

Returns

  • bool

    Whether the player is allowed to transfer the item.

MODULE:StorageEntityRemoved(entity, inventory)

Called when a storage entity is removed. This hook is triggered when a storage entity is removed from the world.

Parameters

  • entity Entity

    The storage entity being removed.

  • inventory Entity

    The inventory associated with the storage entity.

MODULE:StorageInventorySet(entity, inventory, isInitial)

Called when the inventory of a storage entity is set. This hook is triggered when the inventory of a storage entity is set, either initially or after modifications.

Parameters

  • entity Entity

    The storage entity.

  • inventory Entity

    The inventory associated with the storage entity.

  • isInitial Boolean

    Whether the inventory setting is occurring during initialization.

MODULE:StorageOpen(entity, isCar)

Called when a storage is opened. This hook is triggered when a storage is opened, either a car trunk or another storage entity.

Parameters

  • entity Entity

    The storage entity being opened.

  • isCar Boolean

    Whether the storage entity is a car trunk.

MODULE:StorageRestored(storage, inventory)

Called when a storage entity is restored. This hook is triggered when a storage entity is restored.

Parameters

  • storage Entity

    The storage entity.

  • inventory Entity

    The inventory associated with the storage entity.

MODULE:StorageUnlockPrompt(entity)

Called when a prompt to unlock storage is displayed. This hook is triggered when a prompt to unlock storage is displayed, typically for locked containers.

Parameters

  • entity Entity

    The storage entity.

MODULE:isSuitableForTrunk(entity)

Determines whether an entity is suitable for use as storage. This hook allows customization of conditions for considering an entity as suitable storage.

Parameters

  • entity Entity

    The entity being checked.

Returns

  • bool

    Whether the entity is suitable for use as storage.