Hello,
I'm developing a server and decided to share this script. The title explains it all.
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