Documentation
  • 👋Introduction
  • 📚Guides
    • Useful Links
  • 🆓boii_utils
    • Installation
    • Configuration
    • Modules
    • API
      • Callbacks
      • Characters
      • Commands
      • Cooldowns
      • Debugging
      • Entities
      • Environment
      • Framework Bridge
      • Geometry
      • Items
      • Keys
      • Licences
      • Maths
      • Methods
      • Player
      • Requests
      • Strings
      • Tables
      • Timestamps
      • UI Bridges
      • Vehicles
      • Version
      • XP
      • UI Elements
Powered by GitBook
On this page
  • Accessing the Module
  • Server
  • register_item(item_id, use_function)
  • use_item(source, item_id)
  1. boii_utils
  2. API

Items

Provides a way to register and trigger usable item logic server-side. This module allows developers to define behaviour when an item is used in-game.


Accessing the Module

local ITEMS <const> = exports.boii_utils:get("modules.items")

Server

register_item(item_id, use_function)

Registers an item as usable. When the item is used, the callback function will be invoked with the source and item ID.

Parameters

Name
Type
Description

item_id

string

The item identifier

use_function

function

The function to call on item usage

Example

ITEMS.register_item("firstaid", function(source, item_id)
    print("Used item:", item_id, "by player:", source)
end)

use_item(source, item_id)

Triggers a previously registered usable item for the player.

Parameters

Name
Type
Description

source

number

The player source identifier

item_id

string

The item identifier to use

Example

ITEMS.use_item(source, "firstaid")
PreviousGeometryNextKeys

Last updated 1 month ago

🆓