Ir para conteúdo
  • Cadastre-se

(Resolvido)Mining System Buga?


Ir para solução Resolvido por Vodkart,

Posts Recomendados

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!
image.png.ee4b60ec3d72a2e0a137b15d010787b7.png

 

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 por Pifafa (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 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}
	},

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
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

Link para o post
Compartilhar em outros sites

@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

Link para o post
Compartilhar em outros sites
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!
image.thumb.png.a311a0a0a09a41c93aa2d6fdb053ad06.png

Depois de muito empenho enfim consegui o publico de 50+ que sempre sonhei!

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo