Exports
Open Electus Trap Phone from another resource or custom inventory.
Client exports
Open from an inventory item
Pass the inventory item data and slot to the client export. The server still validates that the player owns the configured item.
local itemData = {
name = "trap_phone",
slot = 4,
metadata = {
trapPhoneId = "example-phone-id",
phoneNumber = "5551234",
},
}
exports["electus_trap_phone"]:useTrapPhone(itemData, itemData.slot)| Parameter | Type | Required | Description |
|---|---|---|---|
itemData | table | No | Item payload containing name, slot and metadata or info |
slot | number or table | No | Inventory slot or another item payload |
This client export does not return a result.
Server exports
Open for a player
local success, reason = exports["electus_trap_phone"]:useTrapPhone(source, usedItem, usedSlot, usedData)
if not success then
print(("Could not open trap phone: %s"):format(reason or "unknown"))
end| Parameter | Type | Required | Description |
|---|---|---|---|
source | number | Yes | Player server ID |
usedItem | table or number | No | Used item payload or slot |
usedSlot | table or number | No | Additional slot or item payload |
usedData | table or number | No | Additional inventory payload |
Returns: boolean success, string? reason
When the item context is omitted, the script searches the player's inventory for the configured trap phone.