Inventory
Allows interactions with the players inventory
Functions
CanHoldItem(class, amount)
View source »Returns if a player can hold an item in their local inventory
Parameters
-
class
string
Item class name
-
amount
int
default: 1
Amount of the item
Returns
-
bool
Can hold item
CanHoldItemStorage(class, amount)
View source »Returns if a player can hold an item in their storage chest
Parameters
-
class
string
Item class name
-
amount
int
default: 1
Amount of the item
Returns
-
bool
Can hold item
CanMakeMix(class)
View source »Returns if a player can make a mix
Parameters
-
class
string
Mixture class name
Returns
-
bool
Can make mixture
ClearIllegalInventory(storageType)
View source »Clears illegal items from a players inventory
Parameters
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
ClearInventory(storageType)
View source »Clears a players inventory
Parameters
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
ClearRestrictedInventory(storageType)
View source »Clears restricted items from a players inventory
Parameters
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
DropInventoryItem(itemid)
View source »Drops a specific inventory item
Parameters
-
itemid
int
Item ID
GetInventory(storageType)
View source »Gets a players inventory table
Parameters
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
Returns
-
table
Inventory
GetMaxInventoryStorage()
View source »Returns the max capacity of the players storage box
Returns
-
int
Capacity (in kg)
GiveInventoryItem(itemclass, storageType, restricted, isLoaded, moving, clip)
View source »Gives an inventory item to a player
Parameters
-
itemclass
string
Item class name
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
-
restricted
boolean
default: false
Is item restricted
-
isLoaded
boolean
default: false
(INTERNAL) Used for first time setup when player connects
-
moving
boolean
default: false
(INTERNAL) Is item just being moved? (stops database requests)
-
clip
int
optional
(INTERNAL) (Only used for weapons) Item clip
Returns
-
int
ItemID
HasIllegalInventoryItem(storageType)
View source »Returns if a player has an illegal inventory item
Parameters
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
Returns
-
bool
Has illegal item
-
int
Item ID of illegal item
HasInventoryItem(itemId)
View source »Returns if a client has an inventory item and how much they have
Parameters
-
itemId
int
Item Network ID (use impulse.Inventory.ClassToNetID)
Returns
-
bool
Has item
-
int
Amount
See Also
HasInventoryItem(class, amount)
View source »Returns if a player has an item in their local inventory
Parameters
-
class
string
Item class name
-
amount
int
default: 1
Amount of the item
Returns
-
bool
Has item
HasInventoryItemSpecific(itemID, storageType)
View source »Returns if a player has an specific item. This is used to check if they have the exact item, not just an item of the class specified
Parameters
-
itemID
int
Item ID
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
Returns
-
bool
Has item
HasInventoryItemStorage(class, amount)
View source »Returns if a player has an item in their storage chest
Parameters
-
class
string
Item class name
-
amount
int
default: 1
Amount of the item
Returns
-
bool
Has item
IsInventoryItemRestricted(itemID, storageType)
View source »Returns if a specific inventory item is restricted
Parameters
-
itemID
int
Item ID
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
Returns
-
bool
Is restricted
MoveInventoryItem(itemid, from, to)
View source »Moves a specific inventory item across storages (to move several of the same items use MoveInventoryItemMass as it is faster)
Parameters
-
itemid
int
Item ID
-
from
int
Old storage type
-
to
int
New storage type
MoveInventoryItemMass(class, from, to, amount)
View source »Moves a collection of the same items across storages
Parameters
-
class
string
Item class name
-
from
int
Old storage type
-
to
int
New storage type
-
amount
int
Amount to move
SetInventoryItemEquipped(itemID, state)
View source »Sets a specific inventory item as equipped or not
Parameters
-
itemID
int
Item ID
-
state
boolean
Is equipped
TakeInventoryItem(itemID, storageType, moving)
View source »Takes an inventory item from a player
Parameters
-
itemID
int
Item ID
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
-
moving
boolean
default: false
(INTERNAL) Is item just being moved? (stops database requests)
Returns
-
int
Clip
TakeInventoryItemClass(class, storageType, amount)
View source »Takes an item from a players inventory by class name
Parameters
-
class
string
Item class name
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
-
amount
int
default: 1
Amount to take
UnEquipInventory()
View source »Un equips all iventory items for a player
UseInventoryItem(itemid)
View source »Uses a specific inventory item
Parameters
-
itemid
int
Item ID
impulse.Inventory.ClassToNetID(class)
View source »Used to convert the class to the item's NetID (or table ref)
Parameters
-
class
string
Item class name
Returns
-
int
Item net ID
impulse.Inventory.DBAddItem(ownerid, class, storageType)
View source »Inserts an inventory item into the database. This can be used to control the inventory of offline users
Parameters
-
ownerid
int
OwnerID number
-
class
string
Class name of the item to add
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
impulse.Inventory.DBClearInventory(ownerid, storageType)
View source »Clears a players inventory. This can be used to control the inventory of offline users
Parameters
-
ownerid
int
OwnerID number
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
impulse.Inventory.DBRemoveItem(ownerid, class, storageType, limit)
View source »Deletes an inventory item from the database. This can be used to control the inventory of offline users
Parameters
-
ownerid
int
OwnerID number
-
class
string
Class name of the item to remove
-
storageType
int
default: 1
Storage type (1 is player inventory, 2 is storage)
-
limit
int
default: 1
The amount of items to remove
impulse.Inventory.DBUpdateStoreType(ownerid, classname, limit, oldStorageType, newStorageType)
View source »Updates the storage type for an existing item. This can be used to control the inventory of offline users
Parameters
-
ownerid
int
OwnerID number
-
classname
string
Class name of the item to update
-
limit
int
default: 1
The amount of items to update
-
oldStorageType
int
Old storage type (1 is player inventory, 2 is storage)
-
newStorageType
int
New storage type (1 is player inventory, 2 is storage)
impulse.Inventory.GetCraftingTime(class)
View source »Used to get the crafting time and the sounds to play
Parameters
-
class
string
Item class name
Returns
-
int
Time
-
table
Table of sounds
impulse.Inventory.PickRandomCraftSound(craftType)
View source »Used to pick a random crafting sound for the correct crafting type
Parameters
-
craftType
string
default: generic
Crafting type
Returns
-
string
The random crafting sound based on the crafting type (eg: if type is wood then return wood2.wav)
See Also
impulse.Inventory.SpawnBench(class, pos, ang)
View source »Spawns a workbench
Parameters
-
class
string
Class name of the workbench
-
pos
vector
limit The spawn position
-
ang
angle
The spawn angle
Returns
-
entity
Spawned workbench
impulse.Inventory.SpawnItem(class, pos, bannedPlayer, killTime)
View source »Spawns an inventory item as an Entity
Parameters
-
class
string
Class name of the item to spawn
-
pos
vector
limit The spawn position
-
bannedPlayer
player
optional
Player to ban from picking up
-
killTime
int
optional
Time until the item is removed automatically
Returns
-
entity
Spawned item
impulse.RegisterBench(benchData)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Registers a new workbench
Parameters
-
benchData
Bench data
impulse.RegisterItem(itemData)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Registers a new inventory item
Parameters
-
itemData
Item data
impulse.RegisterMixture(mixData)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Registers a new mixture
Parameters
-
mixData
Mixture data
Tables
CraftingTypes
View source »A collection of crafting types, each uses a different set of sounds
Fields
-
[chemical]
-
[electronics]
-
[fabric]
-
[fuel]
-
[generic]
-
[gunmetal]
-
[metal]
-
[nuclear]
-
[plastic]
-
[powder]
-
[rock]
-
[water]
-
[wood]