I have an annihilator script, but once the lever is hit, it never goes back to it's normal state. I have to restart the server for the lever to go back. The lever id is 1945 and gets transformed to 1946. But it doesent go back to 1945 again.
Also, could somebody please explain the time formula and it works, so I can edit the time of how long time it will go before the lever can be hit again?
The script:
Also, could somebody please explain the time formula and it works, so I can edit the time of how long time it will go before the lever can be hit again?
The script:
-- annihilator lever
function onUse(cid, item, frompos, item2, topos)
monster = "Demon" ------ Monster
pos = {x=228, y=784, z=12} ---Position of monster
monster2 = "Demon" ------ Monster
pos2 = {x=229, y=788, z=12} ---Position of monster
monster2 = "Demon" ------ Monster
pos3 = {x=230, y=784, z=12} ---Position of monster
monster2 = "Demon" ------ Monster
pos4 = {x=231, y=788, z=12} ---Position of monster
monster2 = "Demon" ------ Monster
pos5 = {x=232, y=786, z=12} ---Position of monster
monster2 = "Demon" ------ Monster
pos6 = {x=233, y=786, z=12} ---Position of monster
if item.uid == 8991 and item.itemid == 1945 then
player1pos = {x=231, y=786, z=9, stackpos=253}
player1 = getThingfromPos(player1pos)
player2pos = {x=230, y=786, z=9, stackpos=253}
player2 = getThingfromPos(player2pos)
player3pos = {x=229, y=786, z=9, stackpos=253}
player3 = getThingfromPos(player3pos)
player4pos = {x=228, y=786, z=9, stackpos=253}
player4 = getThingfromPos(player4pos)
dzwignia = os.clock()
if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
queststatus1 = getPlayerStorageValue(player1.uid,8991)
queststatus2 = getPlayerStorageValue(player2.uid,8991)
queststatus3 = getPlayerStorageValue(player3.uid,8991)
queststatus4 = getPlayerStorageValue(player4.uid,8991)
if queststatus1 == -1 and queststatus2 == -1 and queststatus3 == -1 and queststatus4 == -1 then
nplayer1pos = {x=231, y=786, z=12}
nplayer2pos = {x=230, y=786, z=12}
nplayer3pos = {x=229, y=786, z=12}
nplayer4pos = {x=228, y=786, z=12}
doSendMagicEffect(player1pos,2)
doSendMagicEffect(player2pos,2)
doSendMagicEffect(player3pos,2)
doSendMagicEffect(player4pos,2)
doSummonCreature(monster,pos)
doSummonCreature(monster2,pos2)
doSummonCreature(monster,pos3)
doSummonCreature(monster2,pos4)
doSummonCreature(monster,pos5)
doSummonCreature(monster2,pos6)
doTeleportThing(player1.uid,nplayer1pos)
doTeleportThing(player2.uid,nplayer2pos)
doTeleportThing(player3.uid,nplayer3pos)
doTeleportThing(player4.uid,nplayer4pos)
doSendMagicEffect(nplayer1pos,10)
doSendMagicEffect(nplayer2pos,10)
doSendMagicEffect(nplayer3pos,10)
doSendMagicEffect(nplayer4pos,10)
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"A player in your team has already done this quest.")
end
else
doPlayerSendCancel(cid,"You need 4 people to make this quest.")
end
elseif item.uid ==8991 and item.itemid == 1946 then
if (dzwignia - os.clock()) > 60 then
doTransformItem(item.uid,item.itemid-1)
end
if getPlayerAccess(cid) > 0 then
doTransformItem(item.uid,item.itemid-1)
end
end
return 1
end