addItem
Last updated
Last updated
Description
Adds a specified number of an item to a player's inventory.
Parameters
identifier
(string): The citizen ID of the player.
item
(string): The name/key of the item to add.
amount
(number, optional): Number of items to add (default: 1
).
meta
(table, optional): Metadata to attach to the item (e.g., durability or custom data).
slot
(number, optional): Slot to insert into (default: false
).
reason
(string, optional): Reason for adding item (default: 'ps_lib Add Item'
).
Return Value
Returns the result of your inventorys add method.
Also triggers a client-side item box event if required.
Example Use Case
ps.addItem("1234567890", "water_bottle", 5)
print("Added 5 water bottles to player.")