Ir para conteúdo

Featured Replies

Postado

Venho Pedir Ajuda Nesse Script Ele Faz Com Que O Ao O Player Usar XXX Item Ele Ganhe Acesso A Uma Cave Exclusiva Porem Ha Alguns Problemas O Player Nao Pode Sair Da Cave No Caso Pra Vender Itens Ou Deslogar Por Que Outro Pode Roubar A Cave Dele Queria Que A Cave Fosse Dele Ate Dar XXX Tempo Mesmo Ele Saindo Da Cave E Queria Que Outros PLayers Nao Pudessem Usar O Item Quando Alguém Ate Acabar O Tempo Do Outro Player Mesmo Ele Estando Deslogado E Queria Que Esse Item Sumisse Ao Ser Clicado(Nao Muito Importante Acho Que Consigo Fazer).

 

Abaixo Tem O Scripts Ja Pronto E O Credito De Quem Postou !

 


 Creditos ao Bodak Reborn - Bodak

http://www.tibiaking.com/forum/profile/206422-bodak-reborn/


movements/scripts
nome_arquivo.lua
function onStepIn(cid, item, position, fromPosition)
    local config = {
    storage = 789456,
    from = {x = 1049, y = 1051, z = 6}, -- coordenada do canto superior esquerdo da área.
    to = {x = 1051, y = 1053, z = 7}, -- coordenada do canto inferior direito da área.
    maxPlayers = 1, -- quantos jogadores poderão entrar na área ao mesmo tempo.
    pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado.
    }
    
    local function getPlayersInArea(left, right)
        local playersInArea = {}
        for _, cid in ipairs(getPlayersOnline()) do
            if isInRange(getThingPos(cid), left, right) then
                table.insert(playersInArea, cid)
            end
        end
    return playersInArea
    end
    
    if isPlayer(cid) then
        if getPlayerStorageValue (cid, config.storage) < os.time() then
            doPlayerSendTextMessage(cid, 19, "MSG caso o player não tenha acesso.")
            doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
            doTeleportThing(cid, fromPosition, true)
        else
            doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
        end
    
        if table.getn(getPlayersInArea(config.from, config.to)) < config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
            doTeleportThing (cid, config.pos)
            doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
        elseif table.getn(getPlayersInArea(config.from, config.to)) >= config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
            doPlayerSendTextMessage (cid, 19, "MSG caso já tenha o limite de jogadores dentro da área.")
            doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
            doTeleportThing(cid, fromPosition, true)
        end
    end
return true
end
 
movements.xml
<movevent type="StepIn" actionid="ACTION_ID_DO_TP" event="script" value="nome_arquivo.lua" />
 
actions/scripts
nome_arquivo.lua
function onUse(cid, item, frompos, item2, topos)
    local config = {
    timeExhausted = 24, -- tempo em horas para poder usar o item novamente.
    timeForUse = 6, -- tempo em horas que o player poderá entrar na cave.
    exhausted = 456789,
    storage = 789456,
    toKnow = 123456,
    effect = 27, -- efeito que dará ao usar o item.
    }
    
    if getPlayerStorageValue(cid, config.exhausted) < os.time() then
        setPlayerStorageValue (cid, config.storage, config.timeForUse * 60 * 60 + os.time())
        setPlayerStorageValue (cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time())
        setPlayerStorageValue (cid, config.toKnow, 1)
        doSendMagicEffect (getThingPos(cid), config.effect)
        doPlayerSendTextMessage (cid, 19, "MSG informando que o jogador tem acesso à área.")
    else
        doPlayerSendTextMessage (cid, 19, "MSG caso o player esteja exhaustado. (Sobre ter que esperar 24 horas)")
    end
return true
end
 
actions.xml
<action itemid="ID_DO_ITEM" event="script" value="nome_arquivo.lua"/>
 
creaturescripts/scripts
nome_arquivo.lua
local config = {
toKnow = 123456,
storage = 789456,
pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado caso o tempo tenha acabado.
}

function onKill(cid, target, lastHit)
    if getPlayerStorageValue (cid, config.toKnow) == 1 then
        if getPlayerStorageValue (cid, config.storage) < os.time () then
            doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
            doRemoveCreature (cid)
        end
    end
return true
end

function onLogin(cid)
    if getPlayerStorageValue (cid, config.toKnow) == 1 then
        if getPlayerStorageValue (cid, config.storage)  < os.time () then
            doTeleportThing (cid, config.pos)
            setPlayerStorageValue (cid, config.toKnow, 0)
        end
    end
return true
end
 
creaturescripts.xml
<event type="login" name="timeAcess" event="script" value="nome_arquivo.lua"/>
<event type="kill" name="timeAcessKill" event="script" value="nome_arquivo.lua"/>
 
Em creaturescripts/login.lua procure por "registerCreatureEvent" e coloque isso embaixo:
registerCreatureEvent(cid, "timeAcess")
registerCreatureEvent(cid, "timeAcessKill")

 

 

 

 

 

Espero Que Me Ajudem Agradeço A Todos !

Postado

Esta é uma mensagem automática! Este tópico foi movido para a área correta.
Pedimos que você leia as regras do fórum.

Mostrar conteúdo oculto

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo