JixelPatterns
  • JixelPatterns Documentation
  • Troubleshooting
    • Common Issues
    • Setting Up Locations
    • FAQ
  • Dependency
    • Jim_Bridge
      • Animal Ped Support
      • Script Helpers
      • Loader Functions
      • Callbacks
      • Cameras
      • Context Menus
      • Crafting
      • DrawText
      • Dui Functions
      • Input Creator
      • Inventories
      • Job Functions
      • Make Functions
      • Meta Handlers
      • Notifications
      • Phones
      • Player Functions
      • Poly Zones
      • Progress Bars
      • Scale Entity
      • Shops
      • Skillcheck
      • Society Banking
      • Stash Control
      • Targets
      • Vehicles
      • Wrapper Functions
      • Scaleforms
  • Paid Assets
    • Jim-Mechanic
      • Common Issues
      • Installation
      • Locations
        • Creating a Location
      • Nitrous
      • Harness + Seatbelt
      • Emergency Repair Bench
      • Odometer
      • Speedometer
      • Performance Mods
      • Preview System
      • Repair System
      • Car Lifts
      • Plate Change
      • Push Vehicle
      • Stancer Kit
      • Vehicle Seat Picker
    • Jim-Bakery
      • Installation
    • Jim-BeanMachine
      • Installation
    • Jim-BurgerShot
      • Installation
    • Jim-CatCafe
      • Installation
    • Jim-Henhouse
      • Installation
    • Jim-PizzaThis
      • Installation
    • Jim-Popsdiner
      • Installation
  • Free Assets
    • Jim-Mining
      • Installation
      • How To Use
        • Mining
        • Stone Washing
        • Gold Panning
    • Jim-Recycle
      • Installation
      • How To Use
        • Recycling
        • Dumpster Diving
        • Scrapping
    • Jim-Payments
      • Installation
      • How To Use
    • Jim-Shops
      • Installation
      • How To Use
    • Jim-Boarding
      • Installation
      • How To Use
    • Jim-Trains
      • Installation
      • How To Use
    • Jim-Consumbles
      • Installation
      • How To Use
    • Jim-DJBooth
      • Installation
      • How To Use
    • Jim-JobGarage
      • Installation
      • How To Use
    • Jim-Chairs
      • Installation
    • Jim-Notepad
      • Installation
      • How To Use
Powered by GitBook
On this page
  • inventories.lua
  • lockInv(toggle)
  • hasItem(items, amount, src)
  • getPlayerInv(src)
  • itemcontrol.lua
  • createUseableItem(item, funct)
  • invImg(item)
  • addItem(item, amount, info, src)
  • removeItem(item, amount, src, slot)
  • dupeWarn(src, item, amount)
  • breakTool(data)
  • getDurability(item)
  • canCarry(itemTable, src)
  1. Dependency
  2. Jim_Bridge

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:

local hasAll, details = hasItem({"health_potion", "mana_potion"}, 2, playerId)
if hasAll then
    -- Proceed with action
else
    -- Inform the player about missing items
end

getPlayerInv(src)

Retrieves the player’s current inventory.

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

Example:

local inventory = getPlayerInv(playerId)
for k, item in pairs(inventory) do
    print(item.name, item.amount)
end

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)

This doesn't work for ox_inv, you will need to add the event info to it's items.lua

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

Example:

createUseableItem("bandage", function(source)
    -- Heal logic here
end)

invImg(item)

Returns the inventory image path for an item.

Automatically grabs the inventory image link based on inventory script

Example:

local imagePath = invImg("water_bottle")
print(imagePath)

addItem(item, amount, info, src)

Requires Auth callback if called from client side

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

Automatically attempts to add items using detected inventory script

Example:

-- Client Side
addItem("lockpick", 3, {})

-- Server Side
addItem("lockpick", 3, {}, source)

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:

-- Client Side
removeItem(
    "ammo_pistol",
    30,
    nil,
    slot --[[optional]]--
)

-- Server Side
removeItem(
    "ammo_pistol",
    30,
    source,
    slot --[[optional]]--
)

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:

breakTool({ item = "drill", damage = 10 })

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:

local durability, slot = getDurability("drill")
if durability then
    print("Durability:", durability)
    print("Slot:", slot)
end

canCarry(itemTable, src)

Currently server side only

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

Example:

local carryCheck = canCarry({ ["health_potion"] = 2, ["mana_potion"] = 3 }, playerId)
if carryCheck["health_potion"] and carryCheck["mana_potion"] then
    -- Player can carry items.
else
    -- Notify player.
end
PreviousInput CreatorNextJob Functions

Last updated 4 days ago