kito2
www.masteria.net
Hi, I have this script:
It works nice, but it doesnt remove all items over the ground, especially the second tree, could someone help on this?
I rep++!
LUA:
local function createTree(p)
doCreateItem(2722,1,{x=32857, y=32231, z=11})
doCreateItem(2722,1,{x=32857, y=32232, z=11})
doCreateItem(2722,1,{x=32857, y=32233, z=11})
end
function onAddItem(moveitem, tileitem, pos)
tree1pos = {x=32857, y=32231, z=11, stackpos=1} -- postion tree 1
tree2pos = {x=32857, y=32232, z=11, stackpos=1} -- postion tree 2
tree3pos = {x=32857, y=32233, z=11, stackpos=1} -- postion tree 3
tree1 = getThingfromPos(tree1pos)
tree2 = getThingfromPos(tree2pos)
tree3 = getThingfromPos(tree3pos)
if (moveitem.itemid == 6300 or moveitem.itemid == 6301) then
doRemoveItem(moveitem.uid,1)
doSendMagicEffect(pos,2)
local function intenalRemoveItem(pos)
local t = getThingfromPos(pos).uid
if (t > 0) then
return doRemoveItem(t) and intenalRemoveItem(pos)
end
end
intenalRemoveItem(tree1pos)
intenalRemoveItem(tree1pos)
intenalRemoveItem(tree3pos)
doSendMagicEffect(tree1pos,7)
doSendMagicEffect(tree2pos,7)
doSendMagicEffect(tree3pos,7)
p = {treeid = tree1.itemid}
addEvent(createTree, 15*1000, p)
else
end
return 1
end
It works nice, but it doesnt remove all items over the ground, especially the second tree, could someone help on this?
I rep++!