• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua [Help] Make script respond to 2 levers!

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,782
Solutions
25
Reaction score
491
Location
Sweden
I wonder if someone could help me edit this script, making it able to respond to two levers, for example, if you pull one of the two levers, the other get pulled as well.

Here is the script:

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTransformItem(getThingfromPos({x=32062, y=32232, z=8, stackpos=0}).uid, item.itemid == 1945 and 508 or 1284)
	doRelocate({x=32062, y=32232, z=8}, {x=32064, y=32232, z=8})
	doTransformItem(getThingfromPos({x=32063, y=32232, z=8, stackpos=0}).uid, item.itemid == 1945 and 509 or 1284)
	doRelocate({x=32063, y=32232, z=8}, {x=32064, y=32232, z=8})
	return 1, doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
I donno but this is a way to change all levers in position you define maybe this will be helpful for you.
LUA:
local pos = { {x=95,y=130,z=7},{x=95,y=132,z=7},{x=93,y=130,z=7},{x=93,y=132,z=7} }		-- positions of levers 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local check = (item.itemid == 1945 and 1946 or 1945)
	doTransformItem(item.uid,check )
	for i = 1,#pos do
		local change = (check == 1945 and 1946 or 1945)
		if getTileItemById(pos[i],change).uid > 0 then
			doTransformItem(getTileItemById(pos[i],change).uid,check)
		end
	end
	return true
end
 
Just wondering, why is there four positions of levers? I only need two xD

Edit: Nevermind, I didn't read the full post directly!
 
???????????????

I want the script to switch a lever, if the other lever is switched (automaticly) and vise versa
 
Back
Top