I need script for switch id 1945.If i change 14 switches id 1945 for 1946 stone will go down (id 1304) with position xxx. I got script but only for 2 switches can someone help me how to make for more switches?
function onUse(cid, item, frompos, item2, topos)
gatepos = {{x=1093, y=963, z=7, stackpos=1}, {x=1093, y=963, z=7, stackpos=1}}
for i=1, #gatepos do
getgate = getThingfromPos(gatepos)
if item.uid == 3001 and item.itemid == 1945 and getgate.itemid == 3361 then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,1946)
elseif item.uid == 3001 and item.itemid == 1946 and getgate.itemid == 0 then
doCreateItem(3361,1,gatepos)
doTransformItem(item.uid,1945)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
end
return 1
end
function onUse(cid, item, frompos, item2, topos)
gatepos = {{x=1093, y=963, z=7, stackpos=1}, {x=1093, y=963, z=7, stackpos=1}}
for i=1, #gatepos do
getgate = getThingfromPos(gatepos)
if item.uid == 3001 and item.itemid == 1945 and getgate.itemid == 3361 then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,1946)
elseif item.uid == 3001 and item.itemid == 1946 and getgate.itemid == 0 then
doCreateItem(3361,1,gatepos)
doTransformItem(item.uid,1945)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
end
return 1
end