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

[Help] 3 levers to make a ladder

Spoking

Oldschool Developer
Joined
Sep 4, 2007
Messages
434
Reaction score
34
Hello,

I can't figure out why my script is not working, so if there is anyone here that knows, please post.

Code:
local ladderpos = {x=1000, y=1000, z=7}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local a, b, c = 
		getTileItemById({x=999, y=999, z=7}, 1946).uid,
		getTileItemById({x=1000, y=999, z=7}, 1946).uid,
		getTileItemById({x=1001, y=999, z=7}, 1946).uid
		
	if item.itemid == 1945 then
		doTransformItem(item.uid,item.itemid+1)
			if 0<a and 0<b and 0<c then
			local v = getTileItemById(ladderpos, 1386).uid
				if v < 1 then
				doCreateItem(1386, 1, ladderpos)
				
				end
			end
	
	
	elseif item.itemid == 1946 then
		local v = getTileItemById(ladderpos, 1386).uid
		doTransformItem(item.uid,item.itemid-1)
			if 0>a or 0>b or 0>c and v>0 then
			doRemoveItem(v)
			end
	end
	
end

You have to pull 3 switches, and once that is done, a ladder appears.
If the switches aren't ID 1946, remove the ladder if there is a ladder.
 
Code:
local ladderPos = {x = 1000, y = 1000, z = 7}
local t = {
        getTileItemById({x = 999, y = 999, z = 7}, 1946),
        getTileItemById({x = 999, y = 999, z = 7}, 1946),
        getTileItemById({x = 999, y = 999, z = 7}, 1946),
        getTileItemById(ladderpos, 1386)
        }

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local get = t[1], t[2], t[3]
    local l = t[4]
    if get then
        doCreateItem(1386, 1, ladderPos)
    end
    if not t[1] or not t[2] or not t[3] then
        if l then
            doRemoveItem(getThingPos(ladderPos).uid, 1)
        end
    end
    return TRUE
end
test this :p
 
Back
Top