Inventories

inventories.lua

These functions manage inventory locking, item checking, and player inventory retrieval.

lockInv(toggle)

Locks or unlocks the player's inventory.

Freezes/unfreezes movement and toggles hotbar state.

Example:

lockInv(true)  -- Lock inventory
lockInv(false) -- Unlock inventory

hasItem(items, amount, src)

Checks if a player has the specified item(s) in sufficient quantity.

Returns:

  • boolean: Whether the player has the item(s).

  • table: Details of available item counts.

Example:


getPlayerInv(src)

Retrieves the player’s current inventory.

May be used for inventory UI, logging, or crafting systems.

Example:


itemcontrol.lua

This module includes a variety of utility functions for managing items in player inventories, including giving, removing, durability, and use logic.

createUseableItem(item, funct)

Registers a useable item and binds it to a callback function.

Example:


invImg(item)

Returns the inventory image path for an item.

Automatically grabs the inventory image link based on inventory script

Example:


addItem(item, amount, info, src)

Adds a specific amount of an item to a player's inventory.

Automatically attempts to add items using detected inventory script

Example:


removeItem(item, amount, src, slot)

Removes a specific amount of an item from a player’s inventory.

Automatically attempts to remove item using detected inventory script

Example:


dupeWarn(src, item, amount)

Logs or handles a potential duplication exploit involving an item.

This is called automatically if a player has been triggered exploit detection

Disabled if debugMode is enabled


breakTool(data)

Breaks a tool or item, often due to exceeding durability.

Example:


getDurability(item)

Returns the current durability value of a given item.

Searched for the lowest slot number (eg. slot 1) and retreives that items durability

Example:


canCarry(itemTable, src)

Checks if a player can carry the item(s) specified in itemTable.

Example:

Last updated