Eduardo170
Well-Known Member
I try this
Example: U have 5 items on your backpack, you use 1 of 5 and remove it then get a new item
Example: U have 5 items on your backpack, you use 1 of 5 and remove it then get a new item
Code:
local hotaItems = {2335, 2336, 2337, 2338, 2339, 2340, 2341}-- Items to check if you have and remove when using any of them.
local HotaComplete = 2343 -- new item
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local Hota = hotaItems[item.itemid]
for hotaItems = 2335, 2341 do
if player:getItemCount(id) < 1 then
return false
end
end
for hotaItems = 13540, 13545 do
player:removeItem(hotaItems, 1)
end
player:addItem(HotaComplete, 1)
player:getPosition():sendMagicEffect(CONST_ME_STUN)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You received % a new piece on your backpack.')
end
return true
end
end