someone can help to add time to use lever ?
script edited from annihilator quest
script edited from annihilator quest
local config = {
requiredLevel = 2800,
daily = false,
playerPositions = {
Position(33503, 31579, 7),
Position(33503, 31580, 7),
Position(33503, 31581, 7),
Position(33503, 31582, 7)
},
newPositions = {
Position(33503, 31576, 8),
Position(33503, 31577, 8),
Position(33503, 31578, 8),
Position(33503, 31579, 8)
},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1945 then
local storePlayers, playerTile = {}
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerPositions):getTopCreature()
if not playerTile or not playerTile:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need 4 players.")
return true
end
if playerTile:getLevel() < config.requiredLevel then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level ".. config.requiredLevel .." or higher.")
return true
end
storePlayers[#storePlayers + 1] = playerTile
end
local players
for i = 1, #storePlayers do
players = storePlayers
config.playerPositions:sendMagicEffect(CONST_ME_POFF)
players:teleportTo(config.newPositions)
config.newPositions:sendMagicEffect(CONST_ME_ENERGYAREA)
players:setDirection(DIRECTION_EAST)
Game.createMonster("Demonio", {x = 33543, y = 31622, z = 8})
end
elseif item.itemid == 1945 then
if config.daily then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return true
end
end
item:transform(item.itemid == 1945 and 1945 or 1946)
return true
end
requiredLevel = 2800,
daily = false,
playerPositions = {
Position(33503, 31579, 7),
Position(33503, 31580, 7),
Position(33503, 31581, 7),
Position(33503, 31582, 7)
},
newPositions = {
Position(33503, 31576, 8),
Position(33503, 31577, 8),
Position(33503, 31578, 8),
Position(33503, 31579, 8)
},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1945 then
local storePlayers, playerTile = {}
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerPositions):getTopCreature()
if not playerTile or not playerTile:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need 4 players.")
return true
end
if playerTile:getLevel() < config.requiredLevel then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level ".. config.requiredLevel .." or higher.")
return true
end
storePlayers[#storePlayers + 1] = playerTile
end
local players
for i = 1, #storePlayers do
players = storePlayers
config.playerPositions:sendMagicEffect(CONST_ME_POFF)
players:teleportTo(config.newPositions)
config.newPositions:sendMagicEffect(CONST_ME_ENERGYAREA)
players:setDirection(DIRECTION_EAST)
Game.createMonster("Demonio", {x = 33543, y = 31622, z = 8})
end
elseif item.itemid == 1945 then
if config.daily then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return true
end
end
item:transform(item.itemid == 1945 and 1945 or 1946)
return true
end