RemovePlayerItem: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Complete Lua function catalog |
||
| Line 34: | Line 34: | ||
* The operation is rejected rather than allowing the inventory quantity to become negative. | * The operation is rejected rather than allowing the inventory quantity to become negative. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:Player Functions]] | [[Category:Player Functions]] | ||
[[Category:Inventory Functions]] | [[Category:Inventory Functions]] | ||
Latest revision as of 09:54, 15 August 2026
removePlayerItem
Removes a known item from a player's authoritative inventory.
Syntax
bool removePlayerItem(int playerId, string itemKey [, int quantity = 1])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
itemKey |
string |
yes | A rune, armor, or melee weapon key from the server catalog. |
quantity |
int |
no | Number of items to remove, from 1 to 1000; defaults to 1. |
Returns
Returns true when the complete quantity can be removed and the change is replicated; otherwise returns false.
Examples
Consume one item only when the player owns it:
if hasPlayerItem(playerId, "light") then
removePlayerItem(playerId, "light", 1)
end
Notes
- Available only in server-side resource scripts.
- The operation is rejected rather than allowing the inventory quantity to become negative.