My code works but when there is no tile under it will give a very annoying error message is there anyway to get rid of it? the code works after all
ERROR MESSAGE:
[[
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
]]
HERE IS THE CODE:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(itemEx.itemid == 103 or itemEx.itemid == 351 or itemEx.itemid == 352 or itemEx.itemid == 353 or itemEx.itemid == 354 or itemEx.itemid == 355) then
local a = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 253})
local c = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 254})
local b = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 0})
local d = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 1})
if(a.itemid == 0 and c.itemid == 0 and d.itemid == 0 and b.itemid > 0 and b.itemid ~= 101 and b.itemid ~= 5721 and b.itemid ~= 5722 and b.itemid ~= 5723 and b.itemid ~= 5724 and b.itemid ~= 5725 and b.itemid ~= 5726) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
doTransformItem(itemEx.uid, 383)
doCreateItem(384,1,{x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 253})
return TRUE
end
end
if(itemEx.itemid >= 4526 and itemEx.itemid <= 4541) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
doTransformItem(itemEx.uid, 103)
return TRUE
end
if(itemEx.itemid == 383) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
doTransformItem(itemEx.uid, 103)
return TRUE
end
return FALSE
end
ERROR MESSAGE:
[[
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
[20/04/2009 14:26:32] Lua Script Error: [Action Interface]
[20/04/2009 14:26:32] data/actions/scripts/tools/shovel.luanUse
[20/04/2009 14:26:32] luaGetThingFromPos(). Tile not found
]]
HERE IS THE CODE:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(itemEx.itemid == 103 or itemEx.itemid == 351 or itemEx.itemid == 352 or itemEx.itemid == 353 or itemEx.itemid == 354 or itemEx.itemid == 355) then
local a = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 253})
local c = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 254})
local b = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 0})
local d = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 1})
if(a.itemid == 0 and c.itemid == 0 and d.itemid == 0 and b.itemid > 0 and b.itemid ~= 101 and b.itemid ~= 5721 and b.itemid ~= 5722 and b.itemid ~= 5723 and b.itemid ~= 5724 and b.itemid ~= 5725 and b.itemid ~= 5726) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
doTransformItem(itemEx.uid, 383)
doCreateItem(384,1,{x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 253})
return TRUE
end
end
if(itemEx.itemid >= 4526 and itemEx.itemid <= 4541) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
doTransformItem(itemEx.uid, 103)
return TRUE
end
if(itemEx.itemid == 383) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
doTransformItem(itemEx.uid, 103)
return TRUE
end
return FALSE
end