• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help in loop

Flourence

New Member
Joined
Sep 22, 2009
Messages
60
Reaction score
4
when i make this:
Lua:
local itemm = { [7417] = {storage = 10000}, [2466] = {storage = 1020} ,[2650] = {storage = 13000} )
local iteeeemm = getThingFromPos({x = 989, y = 1019, z = 7, stackpos = 1})
for k, v in pairs(itemm) do
   if (iteeeemm.uid ~= 0 and iteeeemm.itemid == k) then
	     doRemoveItem(iteeeemm.uid, 1)
   return true
end
end
now it doesnt remove except the item with the first item id in table ??? ANy help?
 
Last edited:
whats wrong with this?
Lua:
local item = { [7417] = {storage = 10000}, [2466] = {storage = 1020} ,[2650] = {storage = 13000} )
for k, v in pairs(item) do
   if (item.uid ~= 0 and item.itemid == k) then
             doRemoveItem(item.uid, 1)
   return true
end
 
whats wrong with this?
Lua:
local item = { [7417] = {storage = 10000}, [2466] = {storage = 1020} ,[2650] = {storage = 13000} )
for k, v in pairs(item) do
   if (item.uid ~= 0 and item.itemid == k) then
             doRemoveItem(item.uid, 1)
   return true
end

that iteeeeeeem refers to position updated post
 
Code:
  local itemm =  { [7417] = {storage = 10000}, [2466] = {storage = 1020} ,[2650] = {storage = 13000} )
local iteeeemm = getThingFromPos({x = 989, y = 1019, z = 7, stackpos = 1})
for k, v in pairs(itemm) do
   if (iteeeemm.uid ~= 0 and iteeeemm.itemid == k) then
             doRemoveItem(iteeeemm.uid, 1)
   return true
end
end
<- Thats urs--


Code:
  local item =  { [7417] = {storage = 10000}, [2466] = {storage = 1020} ,[2650] = {storage = 13000} )
local item = getThingFromPos({x = 989, y = 1019, z = 7, stackpos = 1})
for k, v in pairs(itemm) do
   if (iteeeemm.uid ~= 0 and iteeeemm.itemid == k) then
             doRemoveItem(iteeeemm.uid, 1)
   return true
end
<- try this
 
because each item has a position:
Code:
local items = {
	[1434] = {pos = {x = 100, y = 200, z = 7}, storage = 1234},
	[1456] = {pos = {x = 100, y = 200, z = 7}, storage = 1235},
	[1457] = {pos = {x = 100, y = 200, z = 7}, storage = 1236},
	[1434] = {pos = {x = 100, y = 200, z = 7}, storage = 1238},
}
for k, v in pairs(items) do
	local item_ = getTileItemById(v.pos, k).uid
	if item_ > 0 then
		doRemoveItem(item_)
	end
end
or if theyre item in the same pos then get them by count
 
humm you dont get me the item must be put on that pos i stated up
so when i use lever it diisappear else in send cancel
so when i put the item id that is the first one in table then it is removed
if i put the other items in table it doesnt remove and send the cancel
 
PHP:
  local itemm =  { [7417] = {storage = 10000}, [2466] = {storage = 1020} ,[2650] = {storage = 13000} )
local iteeeemm = getThingFromPos({x = 989, y = 1019, z = 7, stackpos = 1})
for k, v in pairs(itemm) do
   if (iteeeemm.uid ~= 0 and iteeeemm.itemid == k) then
             doRemoveItem(iteeeemm.uid, 1)
   end
end
It only removes the first item, cuz you return true after removing a item -> the script is stopped.
And if that isnt what you want I dont get your problem..
 
Back
Top