Postado Março 23, 2020 5 anos Olá amigos e amigas. Estou com problema um player chego ao Skill 100 de Mining e logo após o mesmo não conseguiu mais fazer mineração no servidor! Os erros são! Logo vendo a coisa chegamos a: function getMiningInfo(cid) for i = 1, #config_mining.levels do min = config_mining.levels[i].level[1]; max = config_mining.levels[i].level[2] if (getMiningLevel(cid) >= min and getMiningLevel(cid) <= max) then return {quantity = {min = config_mining.levels[i].quant[1], max = config_mining.levels[i].quant[2]}, chance = config_mining.levels[i].percent} end end end Sendo que lvl MAX era para ser 100. Aqui posto o Script como tudo da Lib: STORAGE_SKILL_LEVEL_MINING = 10003 STORAGE_SKILL_TRY_MINING = 10004 config_mining = { levels = { {level = {0,19}, quant = {1,1}, percent = 5}, {level = {10,19}, quant = {1,1}, percent = 6}, {level = {20,59}, quant = {1,1}, percent = 7}, {level = {60,89}, quant = {1,2}, percent = 8}, {level = {90,99}, quant = {1,2}, percent = 9}, {level = {100}, quant = {1,3}, percent = 10} }, rocks = {12679}, -- Id das rochas que podem ser quebradas stones = {}, -- Modelo = {rock_id, rock_id} default_stone = 12681, -- pedra padrão bonus_chance = 5, -- Chance (em porcentagem) de se conseguir um bonus de exp bonus_exp = 2 -- Bonus extra (default: 1) } function getMiningLevel(cid) return getPlayerStorageValue(cid, STORAGE_SKILL_LEVEL_MINING) end function setPlayerMiningLevel(cid, n) setPlayerStorageValue(cid, STORAGE_SKILL_LEVEL_MINING, n) end function addMiningLevel(cid, n) setPlayerMiningLevel(cid, getMiningLevel(cid) + (isNumber(n) and n or 1)) setMiningTry(cid, 0) end function getMiningInfo(cid) for i = 1, #config_mining.levels do min = config_mining.levels[i].level[1]; max = config_mining.levels[i].level[2] if (getMiningLevel(cid) >= min and getMiningLevel(cid) <= max) then return {quantity = {min = config_mining.levels[i].quant[1], max = config_mining.levels[i].quant[2]}, chance = config_mining.levels[i].percent} end end end function getStoneByRock(rockid) for i = 1, #config_mining.stones do if (config_mining.stones[2] == rockid) then return config_mining.stones[1] end end return config_mining.default_stone end function getMiningTries(cid) return getPlayerStorageValue(cid, STORAGE_SKILL_TRY_MINING) end function setMiningTry(cid, n) setPlayerStorageValue(cid, STORAGE_SKILL_TRY_MINING, n) end function addMiningTry(cid, bonus) setMiningTry(cid, getMiningTries(cid) + 1 + (bonus and config_mining.bonus_exp or 0)) if (getMiningTries(cid) >= getMiningExpTo(getMiningLevel(cid))) then -- Up doPlayerSendTextMessage(cid, 22, "You advanced from level " .. getMiningLevel(cid) .. " to level ".. (getMiningLevel(cid) + 1) .." in mining.") if ((getMiningLevel(cid)+1) == getMiningMaxLevel()) then doPlayerSendTextMessage(cid, 22, "Max level reached in mining.") end addMiningLevel(cid) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) setMiningTry(cid, 0) end end function getMiningExpTo(level) return ((level*1.5)+((level+1)*7)) end function getMiningMaxLevel() return config_mining.levels[#config_mining.levels].level[#config_mining.levels[#config_mining.levels].level] end Editado Março 23, 2020 5 anos por Pifafa (veja o histórico de edições)
Postado Março 23, 2020 5 anos Solução tenta usar assim: levels = { {level = {0,19}, quant = {1,1}, percent = 5}, {level = {10,19}, quant = {1,1}, percent = 6}, {level = {20,59}, quant = {1,1}, percent = 7}, {level = {60,89}, quant = {1,2}, percent = 8}, {level = {90,99}, quant = {1,2}, percent = 9}, {level = {100, math.huge}, quant = {1,3}, percent = 10} }, [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Março 24, 2020 5 anos Autor Em 23/03/2020 em 16:26, Vodkart disse: tenta usar assim: levels = { {level = {0,19}, quant = {1,1}, percent = 5}, {level = {10,19}, quant = {1,1}, percent = 6}, {level = {20,59}, quant = {1,1}, percent = 7}, {level = {60,89}, quant = {1,2}, percent = 8}, {level = {90,99}, quant = {1,2}, percent = 9}, {level = {100, math.huge}, quant = {1,3}, percent = 10} }, Obrigado mais uma vez, o problema foi resolvido! Não tenho palavras pra agradecer os anos de ajuda que senhor tem dado para mim! ( Não sei posso ser mais velho que você estou agora com 30 anos) kk
Postado Março 24, 2020 5 anos @Pifafa ele é mais novo uns 2 ou 3 anos xD Compre seus Scripts Agora totalmente seguro e de forma rápida, aceitamos também encomendas. discord.gg/phJZeHa2k4 Projeto ATS (Naruto) Informações Abaixo Facebook Youtube Discord Tutoriais / Conteúdos Clique Aqui
Postado Março 25, 2020 5 anos Autor Em 24/03/2020 em 17:02, LeoTK disse: @Pifafa ele é mais novo uns 2 ou 3 anos xD AHAHAHAHA bom saber, que tempo que voa 30 anos estou! Depois de muito empenho enfim consegui o publico de 50+ que sempre sonhei!
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.