Postado Maio 29, 2014 11 anos Autor mano ta funcionando a parte de adicionar o item mais a porcentagem não ta pq quando eu uso o item ele so da 1 item .
Postado Maio 29, 2014 11 anos Vc quer que tenha uma chance de vir todos? se o cara tiver com uma sorte absurda pode ganhar ate 10 itens isso? Se é isso que vc quer tente random.lua --Configurações --porcengatem dos itens local item1p = 1 --porcentagem do item 1(no caso 1%) local item2p = local item3p = local item4p = local item5p = local item6p = local item7p = local item8p = local item9p = local item10p = --itens que serão sorteados local item1 = 2343 --id do item 1 no caso esta o id 2343 mude... local item2 = local item3 = local item4 = local item5 = local item6 = local item7 = local item8 = local item9 = local item10 = --fim de configuração chance = math.random (1,100) chance1 = math.random (1,100) chance2 = math.random (1,100) chance3 = math.random (1,100) chance4 = math.random (1,100) chance5 = math.random (1,100) chance6 = math.random (1,100) chance7 = math.random (1,100) chance8 = math.random (1,100) chance9 = math.random (1,100) function onUse(cid, item, frompos, item2, topos) if chance == item1p then doPlayerAddItem(cid, item1, 1) end if chance1 <= item2p then doPlayerAddItem(cid, item2, 1) end if chance2 <= item3p then doPlayerAddItem(cid, item3, 1) end if chance3 <= item4p then doPlayerAddItem(cid, item4, 1) end if chance4 <= item5p then doPlayerAddItem(cid, item5, 1)] end if chance5 <= item6p then doPlayerAddItem(cid, item6, 1) end if chance6 <= item7p then doPlayerAddItem(cid, item7, 1) end if chance7 <= item8p then doPlayerAddItem(cid, item8, 1) end if chance8 <= item9p then doPlayerAddItem(cid, item9, 1) end if chance9 <= item10p then doPlayerAddItem(cid, item10, 1) end doRemoveItem(item.uid, 1) return true end Editado Maio 29, 2014 11 anos por llucas75 (veja o histórico de edições) Scripter: |||||||||| 10% Te ajudei?? REP + e ficamos quites... Atenciosamente, Lucas. Abraços!
Postado Maio 29, 2014 11 anos Autor Vc quer que tenha uma chance de vir todos? se o cara tiver com uma sorte absurda pode ganhar ate 10 itens isso? Se é isso que vc quer tente random.lua --Configurações --porcengatem dos itens local item1p = 1 --porcentagem do item 1(no caso 1%) local item2p = local item3p = local item4p = local item5p = local item6p = local item7p = local item8p = local item9p = local item10p = --itens que serão sorteados local item1 = 2343 --id do item 1 no caso esta o id 2343 mude... local item2 = local item3 = local item4 = local item5 = local item6 = local item7 = local item8 = local item9 = local item10 = --fim de configuração chance = math.random (1,100) chance1 = math.random (1,100) chance2 = math.random (1,100) chance3 = math.random (1,100) chance4 = math.random (1,100) chance5 = math.random (1,100) chance6 = math.random (1,100) chance7 = math.random (1,100) chance8 = math.random (1,100) chance9 = math.random (1,100) function onUse(cid, item, frompos, item2, topos) if chance == item1p then doPlayerAddItem(cid, item1, 1) end if chance1 <= item2p then doPlayerAddItem(cid, item2, 1) end if chance2 <= item3p then doPlayerAddItem(cid, item3, 1) end if chance3 <= item4p then doPlayerAddItem(cid, item4, 1) end if chance4 <= item5p then doPlayerAddItem(cid, item5, 1)] end if chance5 <= item6p then doPlayerAddItem(cid, item6, 1) end if chance6 <= item7p then doPlayerAddItem(cid, item7, 1) end if chance7 <= item8p then doPlayerAddItem(cid, item8, 1) end if chance8 <= item9p then doPlayerAddItem(cid, item9, 1) end if chance9 <= item10p then doPlayerAddItem(cid, item10, 1) end doRemoveItem(item.uid, 1) return true end todos não ele tem chance de ganhar 1 dos 10 so que fica variando de item entendeu por que aquele primeiro q vc coloko la ele so recebia 1 item e não varia so vinnha o msm item
Postado Maio 29, 2014 11 anos entendi.. amigo então tenho uma proposta pra ti... não pensei em nenhuma maneira de fazer isso, só pensei se a soma total de % de vir todos os itens são 100%, ou tem 10 itens e a chance de vir cada um é 10%, exemplo 1 5 itens... primeiro item 5% segundo item 6% terceiro item 10% quarto item 14% quinto item 15% 50% de chancer de vir nada... exemplo 2 se forem 10 itens cada um tem 10% de chance.... se forem 5 itens cada um tem 20% de chances... se forem 11 itens cada um tem 9% de chances.... então a procetangem de3 cada um é = 100%/total de itens. Scripter: |||||||||| 10% Te ajudei?? REP + e ficamos quites... Atenciosamente, Lucas. Abraços!
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.