local wall2 = 2829 -- Action.id of "2"'s in the sistem
local wall1 = 2828 -- Action.id of "1"'s in the sistem
wall = {x=588, y=316, z=7, stackpos=1} -- Position where the wall is
getwall1 = getThingfromPos(wall)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.actionid == wall1 then
if item.itemid == 1945 and Vino1 == 0 then
Vino1 = +1
doTransformItem(item.uid,item.itemid,+1)
elseif item.itemid == 1946 and Vino1 >= 1 then
Vino1 = -1
doTransformItem(item.uid,item.itemid,-1)
elseif item.itemid == 1946 and Vino3 >= 1 then
doTransformItem(item.uid,item.itemid,-1)
end
end
if item.actionid == wall2 then
if item.itemid == 1945 and Vino2 >= 1 then
Vino2 = -1
doTransformItem(item.uid,item.itemid,+1)
elseif item.itemid == 1946 and Vino2 >= 0 then
Vino2 = +1
doTransformItem(item.uid,item.itemid,-1)
elseif item.itemid == 1945 and Vino3 > 0 then
doTransformItem(item.uid,item.itemid,-1)
end
end
if Vino1 == 2 and Vino2 == 2 then
addEvent(doRemoveItem, 1 * 60000, getwall1, wall)
addEvent(doTransformItem, 1 * 60000, item.uid, item.itemid, +1)
addEvent(Vino3, 1 * 60000, +1)
end
return 1
end
¡¡¡Hello!!!
I don't test it, but try it. let me know how it works.
Lua:local wall2 = 2829 -- Action.id of "2"'s in the sistem local wall1 = 2828 -- Action.id of "1"'s in the sistem wall = {x=588, y=316, z=7, stackpos=1} -- Position where the wall is getwall1 = getThingfromPos(wall) function onUse(cid, item, fromPosition, itemEx, toPosition) if item.actionid == wall1 then if item.itemid == 1945 and Vino1 == 0 then Vino1 = +1 doTransformItem(item.uid,item.itemid,+1) elseif item.itemid == 1946 and Vino1 >= 1 then Vino1 = -1 doTransformItem(item.uid,item.itemid,-1) elseif item.itemid == 1946 and Vino3 >= 1 then doTransformItem(item.uid,item.itemid,-1) end end if item.actionid == wall2 then if item.itemid == 1945 and Vino2 >= 1 then Vino2 = -1 doTransformItem(item.uid,item.itemid,+1) elseif item.itemid == 1946 and Vino2 >= 0 then Vino2 = +1 doTransformItem(item.uid,item.itemid,-1) elseif item.itemid == 1945 and Vino3 > 0 then doTransformItem(item.uid,item.itemid,-1) end end if Vino1 == 2 and Vino2 == 2 then addEvent(doRemoveItem, 1 * 60000, getwall1, wall) addEvent(doTransformItem, 1 * 60000, item.uid, item.itemid, +1) addEvent(Vino3, 1 * 60000, +1) end return 1 end
¡¡¡Bless you and Cheers up!!!
(Y)(Y)
-Obsdark-
<action actionid="2828;2829" event="script" value="leverWallOpenSystem.lua"/>
local wall2 = 2829 -- Action.id of "2"'s in the sistem
local wall1 = 2828 -- Action.id of "1"'s in the sistem
local WallClock = 9898 -- Storage Value Global who make it works
wall = {xx=857, y=1292, z=7, stackpos=1} -- Position where the wall is
Cerradura = getGlobalStorageValue(WallClock)
getwall1 = getThingfromPos(wall)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 and item.actionid == wall1 then
setGlobalStorageValue(WallClock, +1)
doTransformItem(item.uid,item.itemid,+1)
elseif item.itemid == 1946 and item.actionid == wall1 then
setGlobalStorageValue(WallClock, -1)
doTransformItem(item.uid,item.itemid,-1)
end
if item.itemid == 1945 and item.actionid == wall2 then
setGlobalStorageValue(WallClock, -1)
doTransformItem(item.uid,item.itemid,+1)
elseif item.itemid == 1946 and item.actionid == wall2 then
setGlobalStorageValue(WallClock, +1)
doTransformItem(item.uid,item.itemid,-1)
end
if Cerradura == 4 then
addEvent(doRemoveItem, 1 * 60000, getwall1, wall)
addEvent(doTransformItem, 1 * 60000, wall1, 1945, false)
addEvent(doTransformItem, 1 * 60000, wall2, 1946, false)
end
return 1
end
local switches = {
[4000] = 1945, ----- [Unique ID] = Item ID
[4001] = 1946,
[4002] = 1945,
[4003] = 1946,
}
local wall, id = {x=xxx, y=xxx, z=x, stackpos=1}, WALL_ID -- wallpos , wallID
local reset = 60 -- seconds
local function reset1()
doCreateItem(id, wall)
for k, v in pairs(Q_Switches) do
if getThingPos(k).itemid == 1946 then
doTransformItem(k, 1945)
end
end
end
function onUse(cid, item, frompos, itemEx, topos)
for i, v in pairs(switches) do
if not (getTileThingByPos((getThingPos(i))).itemid == v) then
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
else
doTransformItem(item.uid, 1945)
end
return true
end
end
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
else
doTransformItem(item.uid, 1945)
end
doPlayerSendTextMessage(cid, 22, "A wall was removed for "..reset.." seconds! Hurry!")
doRemoveItem(getThingFromPos(wall).uid, 1)
addEvent(reset1, reset*1000)
return true
end
local c = {
d = {
[1] = {1945, {x=x, y=y, z=Z}}, --[Lever pos] = what id the lever must be to remove the wall
[2] = {1946, {x=x, y=y, z=Z}}, --[Lever pos] = what id the lever must be to remove the wall
[3] = {1946, {x=x, y=y, z=Z}}, --[Lever pos] = what id the lever must be to remove the wall
[4] = {1945, {x=x, y=y, z=Z}} --[Lever pos] = what id the lever must be to remove the wall
},
e = {x=x, y=y, z=z}, --wall pos
f = 60, -- time to add the wall back
g = 1230 -- wall id
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local k, v, i = addEvent(doTransformItem(getTileItemById(c.d[x][2], c.d[x][1]).uid, 1945), addEvent(doCreateItem, c.f*1000, c.g, c.e)), 0
doTransformItem(item.uid, item.id == 1945 and 1946 or 1945)
if getTileItemById(c.e, c.g) then
for x = 1, #c.g do
if getTileItemById(c.d[x][2], c.d[x][1]) then
i = i+1
end
end
if i == #c.g then
doRemoveItem(getThingFromPos(c.e).uid)
addEvent(k, 1)
addEvent(v, 1)
end
else
stopEvent(k)
stopEvent(v)
doCreateItem(c.g, c.e)
end
i = 0
return TRUE
end
I just feel it wont work:
levers = {
{x=x, y=y, z=Z}, -- positions of levers
{x=x, y=y, z=Z},
{x=x, y=y, z=Z},
{x=x, y=y, z=Z}
}
Wallid = -- you put the item.id of the wall here, it must be the number who apparead on remere's. ;)
Wall = {x=x, y=y, z=Z} -- Coords of the wall.
local lever1, lever2, lever3, lever4 = getTileItemById(levers[1], 1945).uid, getTileItemById(levers[2], 1946).uid, getTileItemById(levers[3], 1946).uid, getTileItemById(levers[4], 1945).uid
function onStepIn(cid, item, frompos, itemEx, topos)
if lever1 then
if lever2 then
if lever3 then
if lever4 then
doRemoveItem(wallid.uid, 1)
addEvent(doCreateitem, 60 * 1000, Wallid, Wall)
addEvent(doTransformItem, 60 * 1000, lever1, 1945)
addEvent(doTransformItem, 60 * 1000, lever2, 1945)
addEvent(doTransformItem, 60 * 1000, lever3, 1945)
addEvent(doTransformItem, 60 * 1000, lever4, 1945)
end
end
end
end
return 1
end
<action actionid="9898" event="script" value="Levers4Wall1.lua"/>
levers = {
{x=x, y=y, z=Z}, -- positions of levers
{x=x, y=y, z=Z},
{x=x, y=y, z=Z},
{x=x, y=y, z=Z}
}
Are you sure you copy right?
Reeplace this part of the script with the part i paste down here.
I already fix the original, just for if you want copy again entirely.
Lua:levers = { {x=x, y=y, z=Z}, -- positions of levers {x=x, y=y, z=Z}, {x=x, y=y, z=Z}, {x=x, y=y, z=Z} }
Remember than you must change that coords by the coords of each one of the levers.
¡Have a good day!
(Y)(Y)
Let me know if works or not.
¡Cheers up and Bless you!
(Y)(Y)
-Obsdark-
Why don't you use my script?
levers = {
{x=x, y=y, z=Z}, -- positions of levers
{x=x, y=y, z=Z},
{x=x, y=y, z=Z},
{x=x, y=y, z=Z}
}
itre = 2674 -- yes, is an apple, but it's make the sistem works trust me, reeplace it for any other item that you want.
Wallid = -- you put the item.id of the wall here
Wall = {x=x, y=y, z=Z} -- Coords of the wall.
local lever1, lever2, lever3, lever4 = getTileItemById(levers[1], 1945).uid, getTileItemById(levers[2], 1946).uid, getTileItemById(levers[3], 1946).uid, getTileItemById(levers[4], 1945).uid
function onUse(cid, item, fromPosition, itemEx, toPosition)
if lever1 then
if lever2 then
if lever3 then
if lever4 then
doRemoveItem(wallid.uid, 1)
addEvent(doCreateitem, 60 * 1000, Wallid, Wall)
addEvent(doTransformItem, 4 * 1000, lever1, 1945)
addEvent(doTransformItem, 4 * 1000, lever2, 1945)
addEvent(doTransformItem, 4 * 1000, lever3, 1945)
addEvent(doTransformItem, 4 * 1000, lever4, 1945)
end
end
end
end
return 1
end