Postado Janeiro 2, 2019 6 anos Autor como assim gente, vc só bota os ids das terras que dá pra minerar ali onde eu expliquei e qualquer cave que o player descer que use aqueles IDS de terra vão ser mineráveis.
Postado Janeiro 9, 2019 6 anos Desculpa reviver o topico, más queria pedir se possível colocar um exausted no script, pois msm o próprio tibia ter um exausted de 1 segundo, eu uso OTX e nela é tudo diferente de tfs, ou seja, O Player pode usar uma hotkey "elfbot" auto 1 listas 'Mining' | useongrounditem ID PEDRA 'ID PICK e fica minerando infinitamente fazendo o CPU chegar a 100% e crashando o servidor. eu coloquei uma tabela de exausted no script e funcionou perfeitamente aqui em casa com o cooldown certinho, más quando coloco na Host onde utilizo OTX não tem exausted ainda. Obs : o sistema tbm está com o limite de skill até 20, más os players podem passar o level msm assim, tem player ja com skills 3000 de mining kkk, ai sempre tenho que ficar modificando a storage para poder resetar os skills. abaixo tem o meu modificado. Spoiler terra = {13587,13588,13589,13590,13591,13592,13593} levels = { [-1] = 13586, ---- stones [0] = 13586, --- stones [1] = 13586, --- Blue Stone [10] = 13586, -- Blue Stone [12] = 13586, -- Blue Stone [15] = 13586, -- Blue Stone [17] = 13586, -- Blue Stone [20] = 13586, -- Blue Stone } local config = { storage = 19335, chance = 75, --- chance de achar um item ou não k = 1, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante) experience = 100 } function onUse(cid, item, fromPosition, itemEx, toPosition) local tempo = 5 -- Tempo em segundos para usar o Item novamente. local drops = {} function getDrops(cid) for i= -1,getPlayerStorageValue(cid, config.storage) do if levels then table.insert(drops, levels) end end return true end if exhaustion.check(cid, storage) then doPlayerSendTextMessage(cid, 19, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar novamente.") return false end exhaustion.set(cid, storage, tempo) if isInArray(terra, itemEx.itemid) then getDrops(cid) doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1) local experience = getPlayerStorageValue(cid, config.experience) if experience >= (getPlayerStorageValue(cid, config.storage)^2)/config.k then doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1) doPlayerSendTextMessage(cid, 27, "Parabens, Voce passou de nivel! Seu nivel de minning agora es "..getPlayerStorageValue(cid, config.storage) ..".") if getPlayerStorageValue(cid, config.storage) == 100 then doPlayerSendTextMessage(cid, 20, "Por chegar ao nivel "..getPlayerStorageValue(cid, config.storage) .." Voce ganhou um Mining Helmet.") doPlayerAddItem(cid, 7497, 1, true) end end if config.chance >= math.random(1,100) then if #drops >= 1 then local item = drops[math.random(1,#drops)] doPlayerSendTextMessage(cid, 27, "Voce encontrou uma "..getItemNameById(item)..".") doPlayerAddItem(cid, item, 1, true) end doSendMagicEffect(toPosition, 3) else doSendMagicEffect(toPosition, 2) return TRUE end elseif itemEx.itemid == item.itemid then doPlayerSendTextMessage(cid, 27, "Voce esta no level "..getPlayerStorageValue(cid, config.storage)..".") else return FALSE end return true end
Postado Março 2, 2019 6 anos @xWhiteWolf coloquei a linha que voce mandou colocar pra cair so o item daquele nivel, porem da erro script local terra = {351,352,353,354,355} local levels = { [-1] = 2229, ---- skull [0] = 1294, --- small stone [10] = 2149, -- Small Emerald [12] = 2146, -- Small Sapphire [20] = 2145, -- Small Diamond [40] = 2150, -- Small Amethyst [60] = 2147, -- Small Ruby [80] = 2144, -- Black Pearls [100] = 2143, -- White Pearls [120] = 7761, -- small enchanted emerald [140] = 7759, -- Small Enchanted Sapphiire [160] = 7762, -- Small Enchanted Amethyst [180] = 7760, -- Small Enchanted Ruby [200] = 2157 -- Pepita de Ouro } local config = { storage = 19333, chance = 10, --- chance de achar um item ou não k = 10, --- constante de level.. quanto maior, mais dificil é upar. (a fórmula é level+1 * k) experience = 19334 } local function getDrops(uid) local drops = {} for i = -1, getPlayerStorageValue(uid, config.storage) do if levels then table.insert(drops, levels) end end return drops end function onUse(cid, item, fromPosition, itemEx, toPosition) if isInArray(terra, itemEx.itemid) then local drops = getDrops(cid) doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1) local experience = getPlayerStorageValue(cid, config.experience) if experience >= config.k *(getPlayerStorageValue(cid, config.storage) + 1) then doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1) doPlayerSetStorageValue(cid, config.experience, 0) doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".") doSendMagicEffect(getCreaturePosition(cid),98) doSendAnimatedText(getCreaturePosition(cid), 'Mining UP', 100, cid) if getPlayerStorageValue(cid, config.storage) == 50 then doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.") doPlayerAddItem(cid, 7497, 1, true) end else doPlayerSendTextMessage(cid, 20, "You have picked ".. getPlayerStorageValue(cid, config.experience) .." from ".. config.k *(getPlayerStorageValue(cid, config.storage) + 1) ..". Keep it up.") end if config.chance >= math.random(1,100) then if #drops >= 1 then local itens = drops[math.random(1,#drops)] local item = itens[math.random(1,#itens)] doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".") doPlayerAddItem(cid, item, 1, true) end doSendMagicEffect(toPosition, 2) doSendAnimatedText(toPosition , 'TiickK!', 169) else doSendMagicEffect(toPosition, 2) doSendAnimatedText(toPosition , "Puuff!", 61) return true end elseif itemEx.itemid == item.itemid then doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".") end return true end Linha local itens = drops[math.random(1,#drops)] local item = itens[math.random(1,#itens)] Erro: [13:39:21.808] [Error - Action Interface] [13:39:21.809] data/actions/scripts/novos/mining.lua:onUse [13:39:21.810] Description: [13:39:21.811] data/actions/scripts/novos/mining.lua:59: attempt to get length of local 'itens' (a number value) [13:39:21.814] stack traceback: [13:39:21.817] data/actions/scripts/novos/mining.lua:59: in function <data/actions/scripts/novos/mining.lua:37> Editado Março 2, 2019 6 anos por tetheuscunha (veja o histórico de edições)
Postado Março 7, 2019 6 anos Autor eu mandei colocar isso aqui? isso ai nunca daria certo pq o resultado de itens é um item e não uma tabela de itens, ai qnd vc faz #itens ele dá o erro de vc estar tentando pegar o tamanho do vetor de algo q não é um vetor local itens = drops[math.random(1,#drops)] local item = itens[math.random(1,#itens)]
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.