You are viewing an old version of this page. Return to the latest version.
Version of 14:34, 7 May 2013 by I need to Update My Profile
Difference between revisions of "LUA:HasItem"
(Created page with "This function will return a true or false if a target has an item. ==== Syntax ==== HasItem(target, item_id) ==== Usage ==== <pre> Example(Player) if HasItem(Player, 1157) then...") |
|||
| Line 1: | Line 1: | ||
| − | + | {{PageHeaderChild|LUA|HasItem}} | |
| + | |||
| + | = LUA Functions: HasItem() = | ||
| + | Checks to see if the given player has an item | ||
==== Syntax ==== | ==== Syntax ==== | ||
| − | HasItem( | + | HasItem(param1, param2, [param3]) |
| + | |||
| + | |||
| + | ==== Parameters ==== | ||
| + | ; Required - ''param1'' (Spawn), ''param2'' (int32) | ||
| + | : ''param1'' is the player we want to check | ||
| + | : ''param2'' is the item id to check for | ||
| + | ; Optional - ''param3'' (int8) | ||
| + | : ''param3'' is set to 1 to include the players bank | ||
| + | |||
| + | |||
| + | ==== Returns ==== | ||
| + | True if the player has the item | ||
==== Usage ==== | ==== Usage ==== | ||
<pre> | <pre> | ||
| − | + | function Deleted(Quest, QuestGiver, Player) | |
| − | + | while HasItem(Player, 5642, 1) do | |
| − | + | RemoveItem(Player, 5642) | |
| + | end | ||
end | end | ||
</pre> | </pre> | ||
| − | + | This will delete all quests items when the quest is deleted | |
| − | |||
| − | |||
| − | |||
Latest revision as of 00:04, 14 January 2016
LUA - HasItem
Return to: LUA | Tutorials | Portal | Forum | Project Manager | Bug Tracker
LUA Functions: HasItem()
Checks to see if the given player has an item
Syntax
HasItem(param1, param2, [param3])
Parameters
- Required - param1 (Spawn), param2 (int32)
- param1 is the player we want to check
- param2 is the item id to check for
- Optional - param3 (int8)
- param3 is set to 1 to include the players bank
Returns
True if the player has the item
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