• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Why do i get this error? (luaDoRemoveItem) Item not found

Guxi

Developer
Joined
Mar 17, 2012
Messages
128
Reaction score
12
Location
Croatia
Code:
function onUse(cid, item, frompos, item2, topos)
    tile1 = {x=1144, y=836, z=8, stackpos=1} --change tilepos
    tile2 = {x=1145, y=836, z=8, stackpos=1} --change tilepos
    tile3 = {x=1144, y=837, z=8, stackpos=1} --change tilepos
    tile4 = {x=1145, y=837, z=8, stackpos=1} --change tilepos
    gettile1 = getThingfromPos(tile1)
    gettile2 = getThingfromPos(tile2)
    gettile3 = getThingfromPos(tile3)
    gettile4 = getThingFromPos(tile4)	
	
    if item.uid == 7007 and item.itemid == 9825 then
        doRemoveItem(gettile1,3139)
        doRemoveItem(gettile2,3139)
        doRemoveItem(gettile3,3139)
		doRemoveItem(gettile4,3139)
        doCreateItem(3139,tile1)
        doCreateItem(3139,tile2)
        doCreateItem(3139,tile3)
		doCreateItem(3139,tile4)
		
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 9826 then
        doCreateItem(3139,tile1) --change itemID
        doCreateItem(3139,tile2) --change itemID
        doCreateItem(3139,1,tile3) --change itemID
		doCreateItem(3139,1,tile4)
	doCreateItem(3139,1,tile3) --change itemID
        doRemoveItem(gettile1,3139)
        doRemoveItem(gettile2,3139)
        doRemoveItem(gettile3,3139)
		doRemoveItem(gettile4,3139)
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1


Each time i pull the lever, i get that error to console. But action works good.

- - - Updated - - -

k5YAzms.png
 
Use 1 instead of 3139 with doRemoveItem.

how come with different positions ?


then here we can solve: we going to add something that check the position of the item then remove it..

Code:
function onUse(cid, item, frompos, item2, topos)
    tile1 = {x=1144, y=836, z=8, stackpos=1} --change tilepos
    tile2 = {x=1145, y=836, z=8, stackpos=1} --change tilepos
    tile3 = {x=1144, y=837, z=8, stackpos=1} --change tilepos
    tile4 = {x=1145, y=837, z=8, stackpos=1} --change tilepos
	
    if item.uid == 7007 and item.itemid == 9825 then
	  local check = getTileItemById(tile1, 3139)
			  if (check.itemid == 3139) then doRemoveItem(check.uid) end
			  	  local check1 = getTileItemById(tile2, 3139)
			  if (check1.itemid == 3139) then doRemoveItem(check1.uid) end
			  	  local check2 = getTileItemById(tile3, 3139)
			  if (check2.itemid == 3139) then doRemoveItem(check2.uid) end
			  	  local check3 = getTileItemById(tile4, 3139)
			  if (check3.itemid == 3139) then doRemoveItem(check3.uid) end
        doCreateItem(3139,tile1)
        doCreateItem(3139,tile2)
        doCreateItem(3139,tile3)
		doCreateItem(3139,tile4)
		
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 9826 then
        doCreateItem(3139,tile1) --change itemID
        doCreateItem(3139,tile2) --change itemID
        doCreateItem(3139,1,tile3) --change itemID
		doCreateItem(3139,1,tile4)
	doCreateItem(3139,1,tile3) --change itemID
	  local check = getTileItemById(tile1, 3139)
			  if (check.itemid == 3139) then doRemoveItem(check.uid) end
			  	  local check1 = getTileItemById(tile2, 3139)
			  if (check1.itemid == 3139) then doRemoveItem(check1.uid) end
			  	  local check2 = getTileItemById(tile3, 3139)
			  if (check2.itemid == 3139) then doRemoveItem(check2.uid) end
			  	  local check3 = getTileItemById(tile4, 3139)
			  if (check3.itemid == 3139) then doRemoveItem(check3.uid) end
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
	end
 
Back
Top