Difference between revisions of "LUA:RemoveItem"
(Created page with "Removes 1 of an item from a target, and returns a true or false if successful or not. ==== Syntax ==== RemoveItem(target, item_id) ==== Usage ==== <pre> function Deleted(Quest...") |
|||
| Line 1: | Line 1: | ||
| − | Removes | + | {{PageHeaderChild|LUA|RemoveItem}} |
| + | |||
| + | = LUA Functions: RemoveItem() = | ||
| + | Removes a single item from the player | ||
| + | |||
==== Syntax ==== | ==== Syntax ==== | ||
| − | RemoveItem( | + | RemoveItem(param1, param2) |
| + | |||
| + | |||
| + | ==== Parameters ==== | ||
| + | ; Required - ''param1'' (Spawn), ''param2'' (int32) | ||
| + | : ''param1'' is the player we want to check | ||
| + | : ''param2'' is the item id to remove | ||
| + | |||
| + | |||
| + | ==== Returns ==== | ||
| + | True if an item was removed | ||
| + | |||
==== Usage ==== | ==== Usage ==== | ||
| − | + | <pre> | |
function Deleted(Quest, QuestGiver, Player) | function Deleted(Quest, QuestGiver, Player) | ||
| − | + | while HasItem(Player, 5642, 1) do | |
| − | + | RemoveItem(Player, 5642) | |
| − | + | end | |
| − | |||
| − | |||
end | end | ||
</pre> | </pre> | ||
| − | This will delete | + | |
| + | This will delete all quests items when the quest is deleted | ||
| + | ==== Notes ==== | ||
| + | This only removes one instance of an item, so if you have a stack of 5 and call this function it will now be a stack of 4 | ||
| − | + | Can only be used on a player | |
Latest revision as of 00:08, 14 January 2016
LUA - RemoveItem
Return to: LUA | Tutorials | Portal | Forum | Project Manager | Bug Tracker
LUA Functions: RemoveItem()
Removes a single item from the player
Syntax
RemoveItem(param1, param2)
Parameters
- Required - param1 (Spawn), param2 (int32)
- param1 is the player we want to check
- param2 is the item id to remove
Returns
True if an item was removed
Usage
function Deleted(Quest, QuestGiver, Player)
while HasItem(Player, 5642, 1) do
RemoveItem(Player, 5642)
end
end
This will delete all quests items when the quest is deleted
Notes
This only removes one instance of an item, so if you have a stack of 5 and call this function it will now be a stack of 4
Can only be used on a player