Ir para conteúdo

Featured Replies

Postado

Olá, estava um bom tempo sem mecher com open tibia , e agr que voltei estou bem enferrujado , pois bem estou com um script aqui e não consigo faze-lo funcionar nem q a porr@

segue o script:

 

Spoiler

local cfg = {

    kina = {2000, 2383, 2430, 2173, 2530, 2480, 2464, 2160 }, 
    pala = {2000, 2530, 2480, 2464, 2173, 2160 },
    sorc = {2000, 2190, 2175, 8820, 8819, 2173, 2160 },
    drui = {2000, 2182, 2175, 8820, 8819, 2173, 2160 },

}

function onUse(cid, item)

    if getPlayerStorageValue(cid, 19881) < 1 then
        if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
            doPlayerAddItem(cid, cfg.kina[1], 1)
            doPlayerAddItem(cid, cfg.kina[2], 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
        elseif getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then
            doPlayerAddItem(cid, cfg.sorc, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
        elseif getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 then
            doPlayerAddItem(cid, cfg.drui, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
        elseif getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
            doPlayerAddItem(cid, cfg.pala, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
                end
    else
        doPlayerSendCancel(cid, "It's empty.")
    end

    return true
end

 

Alguem poderia me dizer aonde está o erro e disponibilizar pra mim ??

obs : fica aparecendo no console : 

 

(luaDoPlayerAddItem) Item Not Found

 

creio q seja algo simples , mas não estou conseguindo arrumar .

Se o mundo é mesmo parecido com o que vejo,

Prefiro acreditar no mundo do meu jeito.

( - Renato Russo)

Postado

Não sou Scripter, mais a função de adicionar Item o player, ta dizendo que o item não foi encontrado, ou seja o Item não existe no servidor, ou o ID do item ta incorreto fazendo com que o Scripter não consiga adicionar o Item ao player.

Pelo menos é o que acho, pelo que olhei no erro e no Script.

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

Postado
local cfg = {
    kina = {2000, 2383, 2430, 2173, 2530, 2480, 2464, 2160 }, 
    pala = {2000, 2530, 2480, 2464, 2173, 2160 },
    sorc = {2000, 2190, 2175, 8820, 8819, 2173, 2160 },
    drui = {2000, 2182, 2175, 8820, 8819, 2173, 2160 },
}
function onUse(cid, item)
    if getPlayerStorageValue(cid, 19881) < 1 then
        if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
            doPlayerAddItem(cid, cfg.kina, 1)
            doPlayerAddItem(cid, cfg.kina, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
        elseif getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then
            doPlayerAddItem(cid, cfg.sorc, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
        elseif getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 then
            doPlayerAddItem(cid, cfg.drui, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
        elseif getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
            doPlayerAddItem(cid, cfg.pala, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 19881, 1)
                end
    else
        doPlayerSendCancel(cid, "It's empty.")
    end
    return true
end

 

Postado

Refiz aqui o script, seria isso?

local t = { 
    storage = 19881,
    mainBP = 2000,
        vocations = {
            [4] = {2383, 2430, 2173, 2530, 2480, 2464, 2160}, 
            [3] = {2530, 2480, 2464, 2173, 2160},
            [2] = {2190, 2175, 8820, 8819, 2173, 2160},
            [1] = {2182, 2175, 8820, 8819, 2173, 2160}, 
        },
} 

function onUse(cid, item)
    local voc = t.vocations[getPlayerVocation(cid)]
    if voc then
        if getPlayerStorageValue(cid, 19881) < 1 then
            local bag = doPlayerAddItem(cid, t.mainBP, 1)
               for i = 1, table.maxn(voc) do
	           doAddContainerItem(bag, voc[i], 1)
	       end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Mensagem ao ganhar os items.')
            setPlayerStorageValue(cid, t.storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Mensagem caso já tenha pego os items.')
        end
    end
  return true
end

Se não é isso que você quer ou tiver algum problema, avise : ).

Editado por Wakon (veja o histórico de edições)

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