Ir para conteúdo

Featured Replies

Postado
  • Autor

@MaTTch

Dica: deixe as variáveis locais e não globais.

 

não sei oque isso significa (:

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

Eu que não fumo, queria um cigarro
Eu que não amo você
Envelheci dez anos ou mais
Nesse último mês
Eu que não bebo, pedi um conhaque
Pra enfrentar o inverno
Que entra pela porta
Que você deixou aberta ao sair
avatar_1218.gif
  • Respostas 8
  • Visualizações 1.8k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Tente trocar essa parte:     Por essa:   Dica: deixe as variáveis locais e não globais.

Postado
  • Autor

 

@MaTTch

cara, e fiz uma alteração no script, e adicionei mais itemprizes e agora qdo ganha alguma item, ele da a msg de que ganho o item e em seguida essa ação é executada

  Em 12/08/2016 em 00:02, MaTTch disse:

elseif(M == #configs.stones_prize) then

doPlayerSendTextMessage(cid, 22, "You have not won anything, try again..")

end

local configs = {
sign = {{level = {0,9}, percent = 5},
{level = {10,19}, percent = 8},
{level = {20,29}, percent = 11},
{level = {30,39}, percent = 14},
{level = {40,49}, percent = 17},
{level = {50,59}, percent = 20},
{level = {60,69}, percent = 23},
{level = {70,79}, percent = 26},
{level = {80,89}, percent = 29},
{level = {90,99}, percent = 32},
{level = {100,200}, percent = 35}},
stones = {1285, 1356},
stones_prize = {
{itemprize = 1294, quant = {1,5}, percent = {1,50}}, --small stones
{itemprize = 2145, quant = {1,5}, percent = {51,55}}, -- small diamond
{itemprize = 2146, quant = {1,5}, percent = {56,60}}, -- small sapphire
{itemprize = 2147, quant = {1,5}, percent = {61,65}}, -- small ruby
{itemprize = 2149, quant = {1,5}, percent = {66,70}}, -- small emerald
{itemprize = 2150, quant = {1,5}, percent = {71,75}}, -- small amethyst
},
grounds = {406},
grounds_prize = {
{itemprize = 1294, quant = {1,5}, percent = {1,50}}, --small stones
{itemprize = 2145, quant = {1,5}, percent = {51,55}}, -- small diamond
{itemprize = 2146, quant = {1,5}, percent = {56,60}}, -- small sapphire
{itemprize = 2147, quant = {1,5}, percent = {61,65}}, -- small ruby
{itemprize = 2149, quant = {1,5}, percent = {66,70}}, -- small emerald
{itemprize = 2150, quant = {1,5}, percent = {71,75}}, -- small amethyst
{itemprize = 2219, quant = {1,1}, percent = {76,84}}, -- banana skin
{itemprize = 2220, quant = {1,1}, percent = {85,93}}, -- dirty fur
{itemprize = 5888, quant = {1,4}, percent = {94,98}}, -- iron
{itemprize = 5887, quant = {1,3}, percent = {99,100}}, -- steel
},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local skills = getPlayerSkill(cid, SKILL_SWORD)
if isInArray(configs.stones, itemEx.itemid) then
doPlayerAddSkillTry(cid, SKILL_SWORD, 1)
transform_stone = math.random(1, 100)
	if transform_stone < 16 then
		doTransformItem(itemEx.uid, 2160)
		doPlayerSendTextMessage(cid, 22, "More luck in your next time.")
	else
		for L = 1, #configs.sign do
			if skills >= configs.sign[L].level[1] and skills <= configs.sign[L].level[2] then				
				if item.itemid == 4874 then
					percent = configs.sign[L].percent + 75
					stry = 2
				else
					percent = configs.sign[L].percent
					stry = 1
				end
				print('Skill: '.. skills ..'.')
				print('Porce: '.. percent ..'%.')
				print('Stry: '.. stry ..'.')
				percent_chance = math.random(1, 100)
				print('PC '.. percent_chance ..'.')
				if percent_chance <= percent then
					for_stone_prize = math.random(1, 100)
					for M = 1, #configs.stones_prize do						
						print('SP '.. for_stone_prize..'.')
						if for_stone_prize >= configs.stones_prize[M].percent[1] and for_stone_prize <= configs.stones_prize[M].percent[2] then
							quant = math.random(configs.stones_prize[M].quant[1],configs.stones_prize[M].quant[2])
							doPlayerAddSkillTry(cid, SKILL_SWORD, stry)
							doPlayerAddItem(cid, configs.stones_prize[M].itemprize, quant)
							doPlayerSendTextMessage(cid, 22, "You won ".. quant .." ".. getItemNameById(configs.stones_prize[M].itemprize) ..".")
							break_chance = math.random(1,100)
							if break_chance < 6 then
								doTransformItem(itemEx.uid, 2160)
							end							
						elseif (M == #configs.stones_prize) then
							doPlayerSendTextMessage(cid, 22, "You have not won anything, try again..")												
						end
					end
				else
					doPlayerSendTextMessage(cid, 22, "You did not succeed in mining , try again.")
				end
			break
			end		
		end
	end	
elseif isInArray(configs.grounds, itemEx.itemid) then
		doPlayerAddSkillTry(cid, SKILL_SWORD, 1)
		transform_ground = math.random(1, 100)
			if transform_ground < 16 then
				doTransformItem(itemEx.uid, 2160)
				doPlayerSendTextMessage(cid, 22, "More luck in your next time.")
			else
				for L = 1, #configs.sign do
					if skills >= configs.sign[L].level[1] and skills <= configs.sign[L].level[2] then				
						if item.itemid == 4874 then
							percent = configs.sign[L].percent + 75
							stry = 2
						else
							percent = configs.sign[L].percent
							stry = 1
						end
						print('Skill: '.. skills ..'.')
						print('Porce: '.. percent ..'%.')
						print('Stry: '.. stry ..'.')
						percent_chance = math.random(1, 100)
						print('PC '.. percent_chance ..'.')
						if percent_chance <= percent then
							for_ground_prize = math.random(1, 100)
							for M = 1, #configs.grounds_prize do						
								print('SP '.. for_ground_prize..'.')
								if for_ground_prize >= configs.grounds_prize[M].percent[1] and for_ground_prize <= configs.grounds_prize[M].percent[2] then
									quant = math.random(configs.grounds_prize[M].quant[1],configs.grounds_prize[M].quant[2])
									doPlayerAddSkillTry(cid, SKILL_SWORD, stry)
									doPlayerAddItem(cid, configs.grounds_prize[M].itemprize, quant)
									doPlayerSendTextMessage(cid, 22, "You won ".. quant .." ".. getItemNameById(configs.grounds_prize[M].itemprize) ..".")
									break_chance = math.random(1,100)
									if break_chance < 6 then
										doTransformItem(itemEx.uid, 2160)
									end
								elseif (M == #configs.grounds_prize) then
									doPlayerSendTextMessage(cid, 22, "You have not won anything, try again..")
								end
							end
						else
							doPlayerSendTextMessage(cid, 22, "You did not succeed in mining , try again.")
						end
					break
					end		
				end
			end	
	end
end

 

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

Eu que não fumo, queria um cigarro
Eu que não amo você
Envelheci dez anos ou mais
Nesse último mês
Eu que não bebo, pedi um conhaque
Pra enfrentar o inverno
Que entra pela porta
Que você deixou aberta ao sair
avatar_1218.gif
Postado

@blackz

Mostrar conteúdo oculto

 

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.7k

Informação Importante

Confirmação de Termo