local config = {
lever_uid = 7002,
walls = {
[1] = {id = 1052, pos = {x=1496, y=1488, z=5}, relocate = {x=1496, y=1489, z=5}},
[2] = {id = 1052, pos = {x=1497, y=1488, z=5}, relocate = {x=1497, y=1489, z=5}}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 7002 then
if item.itemid == 1945 then
for i = 1, #config.walls do
local getWall = getTileItemById(config.walls.pos, config.walls.id).uid
if getWall > 0 then
doRemoveItem(getWall)
end
end
doTransformItem(item.uid, item.itemid+1)
return TRUE
elseif item.itemid == 1946 then
for i = 1, #config.walls do
local getWall = getTileItemById(config.walls.pos, config.walls.id).uid
if getWall == 0 then
doRelocate(config.walls.pos, config.walls.relocate)
doCreateItem(config.walls.id, 1, config.walls.pos)
end
end
doTransformItem(item.uid,item.itemid-1)
return TRUE
end
end
return FALSE
end
function onUse(cid, item, frompos, item2, topos)
wall1 = {x=1496, y=1488, z=5, stackpos=1}
wall2 = {x=1497, y=1488, z=5, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
if item.uid == 7002 and item.itemid == 1945 then
doRemoveItem(getwall1.uid,1)
doRemoveItem(getwall2.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == 7002 and item.itemid == 1946 then
doCreateItem(1052,1,wall1)
doCreateItem(1052,1,wall2)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return 1
end
function onUse(cid, item, frompos, item2, topos)
local wall1, wall2 = {x=1496, y=1488, z=5, stackpos=1}, {x=1497, y=1488, z=5, stackpos=1}
local getwall1, getwall2 = getThingfromPos(wall1),getThingfromPos(wall2)
local timeToComeBack = 120 -- in seconds
if item.uid == 7002 and isInArray({1945,1946},item.itemid) then
doRemoveItem(getwall1.uid,1)
doRemoveItem(getwall2.uid,1)
addEvent(doCreateItem,timeToComeBack*1000,1052,1,wall2)
addEvent(doCreateItem,timeToComeBack*1000,1052,1,wall1)
doTransformItem(item.uid,(item.itemid == 1945 and 1946 or 1945))
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return true
end