• 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!

4 levers 1 wall

kokosal

New Member
Joined
Feb 21, 2010
Messages
115
Reaction score
0
I need some help.
Zyntax made this script, but levers dont reset back to 1945 when the wall came back
And how can i change the position on the levers that remove the wall?

Can someone plz help me ^_^

Lua:
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
 
This config lets you define the directions which the levers have to be in order to activate the correct setting.
Like:
[4000] = 1945, --lever1 has to look left
[4001] = 1946, --lever2 has to look right
[4002] = 1945, --lever3 has to look left
[4003] = 1946 --lever4 has to look right

If you want to change the code, simply change the itemIDs in this config.
If you set all itemIDs to 1945, then the script will activate the removeWall thing if ALL levers look to the left.

This should correct the function which set the levers back to 1945
Lua:
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(switches) do
		if getThingPos(k).itemid == 1946 then
			doTransformItem(getThingPos(k).uid, 1945)--this should do
		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
Sorry for not beeing that clear in my last posts ;)

If anything is off~ just reply here!
 
Last edited:
Back
Top