NSS Docs
DiscordStoreHomepage
nss_libs
nss_libs
  • README
  • Changelog
  • UI components
    • NssUiApi basics
    • NssAudio
    • NssButton
    • NssClient
    • NssConfirm
    • NssHelper
    • NssLoadingIndicator
    • NssModal
    • NssPadLock
    • NssResponsive
    • NssSimpleTextEditor
    • NssSvgReplacer
    • NssTextBox
    • NssTip
  • Client/server modules
    • AttachProp
    • Blip
    • Character
      • Client Character
      • Server Character
    • Chunk
    • ClientEvent
    • ConfigValidator
    • Database
    • DatabaseUpdater
    • DependencyAutoRestart
    • Discord
    • EntityInRange
    • Helper
      • Client Helper
      • Server Helper
      • Shared Helper
    • Inventory
    • Keyboard
    • Notify
    • Npc
    • ParticleFxPlayer
    • PointInRange
    • Prompts
    • ServerEvent
    • VersionCheck
Powered by GitBook
On this page
  • nss_libs - Inventory
  • How to use
  • TODO

Was this helpful?

  1. Client/server modules

Inventory

nss_libs - Inventory

This module contains an inventory api that wraps inventories from other frameworks like Vorp.

How to use

Client side

-- Gets the client api.
---@type NssLibsInventoryClientApi
inventory_client = exports.nss_libs:getClientInventoryApi(GetCurrentResourceName())

-- Use item of with inventory item id 12 and item name 'coal'.
inventory_client:useItem(12, 'coal')

Server side

-- Gets the server api.
---@type NssLibsInventoryApi
inventory = exports.nss_libs:getInventoryApi(GetCurrentResourceName())

local server_player_id = 12 -- Just an example.

-- Add 1 coal to the inventory.
inventory:addItem(server_player_id, 'coal', 1)

-- Gets all items from the user inventory.
---@type NssLibsInventoryNamedUserInventoryItemList|nil
local user_inventory_items = inventory:getUserInventory(server_player_id)

TODO

PreviousShared HelperNextKeyboard

Last updated 1 year ago

Was this helpful?