Em 29/11/2017 at 23:10, Allangod disse:
Boa tarde galera.
Gostaria de uma alavanca que teleporte 4 players para uma hunt e que outros 4 players só poderiam acessar essa hunt caso os 4 saiam de lá.
Gostaria de que se exigisse um certo item de cada player (configurado por mim) para ter acesso a essa hunt (Tipo a desert quest).
Valeu
Ta ai, se não for uma quest(Só pode fazer uma vez) avisa.
local config = {
time = 60, --Tempo para fazer a quest, em minutos.
toPosition = {x = x, y = y, z = z}, --Para onde os jogadores serão teleportados.
positions = {
{x = x, y = y, z = z}, --Posições que os jogadores devem ficar.
{x = x, y = y, z = z},
{x = x, y = y, z = z},
{x = x, y = y, z = z},
},
level = 100, --Level mínimo para fazer a quest.
storages = {8605, 8606},
itemid = XXXX, -- Numero do Item que será removido
}
function onUse(cid)
local pid = {}
if getPlayerStorageValue(cid, config.storages[2]) > -1 then
return doPlayerSendCancel(cid, "You already completed that quest.")
end
for _, online in pairs(getPlayersOnline()) do
if getPlayerStorageValue(online, config.storages[1]) > -1 then
return doPlayerSendCancel(cid, "Someone is at the quest right now.")
end
end
for i, position in pairs(config.positions) do
local p = getTopCreature(position).uid
if p < 1 or not isPlayer(p) then
return doPlayerSendCancel(cid, "Not enough players to start the quest.")
elseif getPlayerLevel(p) < config.level then
return doPlayerSendCancel(cid, "Some player is at a level below "..config.level..".")
end
pid[#pid + 1] = p
end
for _, player in pairs(pid) do
if getPlayerItemCount(cid, config.itemid) >= 1 then
doPlayerRemoveItem(cid, itemid, 1)
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Good luck at the quest!\nTime: "..config.time.." minutes.")
doTeleportThing(player, getClosestFreeTile(player, config.toPosition))
setPlayerStorageValue(player, config.storages[1], 1)
else
doPlayerSendCancel(cid, "Você não possui o item " .. getItemNameById(itemid) .. ".")
end
end
addEvent(function()
for _, player in pairs(pid) do
if isPlayer(player) and getPlayerStorageValue(player, config.storages[1]) > -1 then
doPlayerSendTextMessage(player, 27, "Oh, timeout. Sorry. :/")
setPlayerStorageValue(player, config.storages[1], -1)
doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
end
end
end, config.time * 60 * 1000)
return true
end
Coloca essas linhas no script de saida da Hunt ou no baú