Ziggy
Member
- Joined
- Aug 11, 2007
- Messages
- 49
- Reaction score
- 6
local FRUIT = {2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2684, 2685, 5097, 8839, 8840, 8841}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(FRUIT, itemEx.itemid) and doPlayerRemoveItem(cid, 2006, 1, 0) then
doRemoveItem(itemEx.uid, 1)
doPlayerAddItem(cid, 2006, itemEx.itemid == 2678 and 14 or 21)
return true
end
end
The script works perfectly except for that if the player has more than one of a fruit or coconut, it takes all of that fruit/coconut instead of just one.
doRemoveItem(itemEx.uid)
doRemoveItem(itemEx.uid, 1)
This part is making TFS go infinite loop mode for me whenever it finds a non-empty vial before it finds an empty one. Can anyone else confirm?Code:local FRUIT = {2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2684, 2685, 5097, 8839, 8840, 8841} function onUse(cid, item, fromPosition, itemEx, toPosition) if isInArray(FRUIT, itemEx.itemid) and [B][COLOR="red"]doPlayerRemoveItem(cid, 2006, 1, 0)[/COLOR][/B] then doRemoveItem(itemEx.uid, 1) doPlayerAddItem(cid, 2006, itemEx.itemid == 2678 and 14 or 21) return true end end