• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Pits of Inferno (15 Levers)

DjowYeap

New Member
Joined
Mar 11, 2013
Messages
18
Reaction score
2
Hello,
I'm developing a server and decided to share this script. The title explains it all.

Code:
local LeversPosition = {
	{x = 32846, y = 32318, z = 12, stackpos = 1},
	{x = 32847, y = 32332, z = 13, stackpos = 1},
	{x = 32889, y = 32349, z = 15, stackpos = 1},
	{x = 32887, y = 32330, z = 12, stackpos = 1},
	{x = 32874, y = 32334, z = 12, stackpos = 1},
	{x = 32843, y = 32359, z = 12, stackpos = 1},
	{x = 32850, y = 32366, z = 13, stackpos = 1},
	{x = 32843, y = 32352, z = 14, stackpos = 1},
	{x = 32853, y = 32359, z = 14, stackpos = 1},
	{x = 32891, y = 32328, z = 14, stackpos = 1},
	{x = 32874, y = 32354, z = 14, stackpos = 1},
	{x = 32887, y = 32355, z = 13, stackpos = 1},
	{x = 32874, y = 32365, z = 13, stackpos = 1},
	{x = 32886, y = 32337, z = 13, stackpos = 1},
	{x = 32859, y = 32364, z = 13, stackpos = 1}
}

function onUse(cid, item, fromPos, itemEx, toPos)
	if(item.itemid == 1945) then
		if(getThingFromPos(LeversPosition[1]).itemid == 1946 and getThingFromPos(LeversPosition[2]).itemid == 1946 and getThingFromPos(LeversPosition[3]).itemid == 1946 and getThingFromPos(LeversPosition[4]).itemid == 1946 and getThingFromPos(LeversPosition[5]).itemid == 1946 and getThingFromPos(LeversPosition[6]).itemid == 1946 and getThingFromPos(LeversPosition[7]).itemid == 1946 and getThingFromPos(LeversPosition[8]).itemid == 1946 and getThingFromPos(LeversPosition[9]).itemid == 1946 and getThingFromPos(LeversPosition[10]).itemid == 1946 and getThingFromPos(LeversPosition[11]).itemid == 1946 and getThingFromPos(LeversPosition[12]).itemid == 1946 and getThingFromPos(LeversPosition[13]).itemid == 1946 and getThingFromPos(LeversPosition[14]).itemid == 1946 and getThingFromPos(LeversPosition[15]).itemid == 1946) then
			for i = 1, #LeversPosition do
				doTransformItem(getThingFromPos(LeversPosition[i]).uid, 1945)
			end
			doRemoveItem(getThingFromPos({x = 32851, y = 32333, z = 12, stackpos = 1}).uid, 1)
			doRemoveItem(getThingFromPos({x = 32852, y = 32333, z = 12, stackpos = 1}).uid, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to pull the other 15 switches first.")
		end
		doTransformItem(item.uid, item.itemid + 1)
	elseif(item.itemid == 1946) then
		if(getThingFromPos({x = 32851, y = 32333, z = 12, stackpos = 1}).itemid == 0) then
			doCreateItem(1304, 1, {x = 32851, y = 32333, z = 12, stackpos = 1})
			doCreateItem(1304, 1, {x = 32852, y = 32333, z = 12, stackpos = 1})
			for i = 1, #LeversPosition do
				doTransformItem(getThingFromPos(LeversPosition[i]).uid, 1945)
			end
		end
		doTransformItem(item.uid, item.itemid - 1)
	end
	return true
end
 
Lua:
if(item.itemid == 1945) then
		if(getThingFromPos(LeversPosition[1]).itemid == 1946 and getThingFromPos(LeversPosition[2]).itemid == 1946 and getThingFromPos(LeversPosition[3]).itemid == 1946 and getThingFromPos(LeversPosition[4]).itemid == 1946 and getThingFromPos(LeversPosition[5]).itemid == 1946 and getThingFromPos(LeversPosition[6]).itemid == 1946 and getThingFromPos(LeversPosition[7]).itemid == 1946 and getThingFromPos(LeversPosition[8]).itemid == 1946 and getThingFromPos(LeversPosition[9]).itemid == 1946 and getThingFromPos(LeversPosition[10]).itemid == 1946 and getThingFromPos(LeversPosition[11]).itemid == 1946 and getThingFromPos(LeversPosition[12]).itemid == 1946 and getThingFromPos(LeversPosition[13]).itemid == 1946 and getThingFromPos(LeversPosition[14]).itemid == 1946 and getThingFromPos(LeversPosition[15]).itemid == 1946) then
			for i = 1, #LeversPosition do
				doTransformItem(getThingFromPos(LeversPosition[i]).uid, 1945)
			end
			doRemoveItem(getThingFromPos({x = 32851, y = 32333, z = 12, stackpos = 1}).uid, 1)
			doRemoveItem(getThingFromPos({x = 32852, y = 32333, z = 12, stackpos = 1}).uid, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to pull the other 15 switches first.")
		end
		doTransformItem(item.uid, item.itemid + 1)

Shortened:

Lua:
if(item.itemid == 1945) then
	for k, v in pairs(LeversPosition) do
		if(getTileItemById(v, 1946).uid < 1) then
			return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to pull the other 15 switches first.")
		end
	end
	for k, v in pairs(LeversPosition) do
		doTransformItem(getTileItemById(v, 1946).uid, 1945)
	end
	doRemoveItem(getTileItemById({x = 32851, y = 32333, z = 12}, 1304).uid, 1)
	doRemoveItem(getTileItemById({x = 32852, y = 32333, z = 12}, 1304).uid, 1)
 
Lua:
if(item.itemid == 1945) then
		if(getThingFromPos(LeversPosition[1]).itemid == 1946 and getThingFromPos(LeversPosition[2]).itemid == 1946 and getThingFromPos(LeversPosition[3]).itemid == 1946 and getThingFromPos(LeversPosition[4]).itemid == 1946 and getThingFromPos(LeversPosition[5]).itemid == 1946 and getThingFromPos(LeversPosition[6]).itemid == 1946 and getThingFromPos(LeversPosition[7]).itemid == 1946 and getThingFromPos(LeversPosition[8]).itemid == 1946 and getThingFromPos(LeversPosition[9]).itemid == 1946 and getThingFromPos(LeversPosition[10]).itemid == 1946 and getThingFromPos(LeversPosition[11]).itemid == 1946 and getThingFromPos(LeversPosition[12]).itemid == 1946 and getThingFromPos(LeversPosition[13]).itemid == 1946 and getThingFromPos(LeversPosition[14]).itemid == 1946 and getThingFromPos(LeversPosition[15]).itemid == 1946) then
			for i = 1, #LeversPosition do
				doTransformItem(getThingFromPos(LeversPosition[i]).uid, 1945)
			end
			doRemoveItem(getThingFromPos({x = 32851, y = 32333, z = 12, stackpos = 1}).uid, 1)
			doRemoveItem(getThingFromPos({x = 32852, y = 32333, z = 12, stackpos = 1}).uid, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to pull the other 15 switches first.")
		end
		doTransformItem(item.uid, item.itemid + 1)

Shortened:

Lua:
if(item.itemid == 1945) then
	for k, v in pairs(LeversPosition) do
		if(getTileItemById(v, 1946).uid < 1) then
			return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You need to pull the other 15 switches first.")
		end
	end
	for k, v in pairs(LeversPosition) do
		doTransformItem(getTileItemById(v, 1946).uid, 1945)
	end
	doRemoveItem(getTileItemById({x = 32851, y = 32333, z = 12}, 1304).uid, 1)
	doRemoveItem(getTileItemById({x = 32852, y = 32333, z = 12}, 1304).uid, 1)


Thanks teckman.
I will try, and if it works I will update the topic.
 
Back
Top