Ir para conteúdo

Featured Replies

  • Respostas 45
  • Visualizações 3.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local config = {    [90] = {ID, COUNT},    [80] = {ID, COUNT},    [59] = {ID, COUNT},    [50] = {ID, COUNT},    [40] = {ID, COUNT},    [30] = {ID, COUNT},    [20] = {ID, COUNT},    [10] = {ID, COUNT},

  • Esse é o cara ... No caso esta para usar só 1 vez... Caso queira usar mais que uma vez só remova essa parte if getPlayerStorageValue(cid, STORAGE) > 0 then doPlayerSendTextMessage(ci

Postado

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 por llucas75 (veja o histórico de edições)

Scripter: |||||||||| 10%

 

 

Te ajudei?? REP + e ficamos quites...  ;D

 

Atenciosamente,

                   Lucas.

Abraços!

Postado
  • 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

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...  ;D

 

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.

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

Informação Importante

Confirmação de Termo