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

Four levers of function

Basic script, edit it as your want.
Code:
--config--
leverpos1 = { x = x, y = y, z = z, stackpos = 1 } -- the position of lever 1
leverpos2 = { x = x, y = y, z = z, stackpos = 1 } -- the position of lever 2 and same for 3 and 4
leverpos3 = { x = x, y = y, z = z, stackpos = 1 }
leverpos4 = { x = x, y = y, z = z, stackpos = 1 }
levers = {
[lever1] = getThingfromPos(leverpos1),
[lever2] = getThingfromPos(leverpos2),
[lever3] = getThingfromPos(leverpos3),
[lever4] = getThingfromPos(leverpos4)
}
--config--
function onUse(cid, item, frompos, item2, topos)
if levers.itemid == 1945 then
doTransformItem(levers.uid, levers.itemid+1)
elseif levers.itemid == 1946 then
--Your code Here--
doTransformItem(levers.uid, levers.itemid-1)
end
Didnt check but i think there is no errors, if there is then it will just be cus ive just woke up lol xD
 
Last edited by a moderator:
Think this should work:
PHP:
--config--
local positions = { -- the positions of each lever
	[{x=x, y=y, z=z, stackpos=1}] = 1946,
	[{x=x, y=y, z=z, stackpos=1}] = 1946,
	[{x=x, y=y, z=z, stackpos=1}] = 1946,
	[{x=x, y=y, z=z, stackpos=1}] = 1946
}
--config--
function onUse(cid, item, frompos, item2, topos)
	doTransformLever(item)
	for position, itemid in pairs(positions) do
		if (getThingfromPos(position).itemid ~= itemid) then
			-- some lever is not the required itemid, do something or just return 1?
			return 1
		end
	end
	-- all levers are the correct itemid
	return 1
end 

function doTransformLever(lever)
	lever.itemid = lever.itemid == 1945 and 1946 or 1945
	doTransformItem(lever.uid, lever.itemid)
	return lever.itemid
end

Change pos and itemid, so if you change to like [pos] = 1945, then it must be 1945 to complete, got it? lol

that means that the lever of that positions must be the itemid to be compeleted!
 
Last edited:
Back
Top