Postado Maio 19, 2015 10 anos local config = { [1] = {item = 2160, count = 10, msg = "blablabla."}, -- 60% [2] = {item = 2160, count = 10, msg = "blablabla."}, -- 15% [3] = {item = 2160, count = 10, msg = "blablabla."}, -- 14% [4] = {item = 2160, count = 10, msg = "blablabla."}, -- 5% [5] = {item = 2160, count = 10, msg = "blablabla."}, -- 3% [6] = {item = 2160, count = 10, msg = "blablabla."}, -- 2% [7] = {item = 2160, count = 10, msg = "blablabla."}, -- 1% } function onUse(cid, item, fromPosition, itemEx, toPosition) local x, vetor = math.random(1, 100), 0 if x <= 60 then vetor = 1 elseif x > 60 and x <= 75 then vetor = 2 elseif x > 75 and x <= 89 then vetor = 3 elseif x > 89 and x <= 94 then vetor = 4 elseif x > 94 and x <= 97 then vetor = 5 elseif x > 97 and x <= 99 then vetor = 6 elseif x == 100 then vetor = 7 end local reward = config[vetor] if reward then doCreatureSay(cid, reward.msg, TALKTYPE_ORANGE_1) doPlayerAddItem(cid, reward.item, reward.count) doRemoveItem(cid, item.uid, 1) end return true end STYLLER OT 2022
Postado Maio 19, 2015 10 anos Autor biel.stocco, Desculpe eu estava sem tempo, eu ia fazer o script mais snowsz já fez At+ tudo bem manin, agradeço a intenção e obg mesmo, fico muito grato quando pelo menos tentam ajudar de bom coração! local config = { [1] = {item = 2160, count = 10, msg = "blablabla."}, -- 60% [2] = {item = 2160, count = 10, msg = "blablabla."}, -- 15% [3] = {item = 2160, count = 10, msg = "blablabla."}, -- 14% [4] = {item = 2160, count = 10, msg = "blablabla."}, -- 5% [5] = {item = 2160, count = 10, msg = "blablabla."}, -- 3% [6] = {item = 2160, count = 10, msg = "blablabla."}, -- 2% [7] = {item = 2160, count = 10, msg = "blablabla."}, -- 1% } function onUse(cid, item, fromPosition, itemEx, toPosition) local x, vetor = math.random(1, 100), 0 if x <= 60 then vetor = 1 elseif x > 60 and x <= 75 then vetor = 2 elseif x > 75 and x <= 89 then vetor = 3 elseif x > 89 and x <= 94 then vetor = 4 elseif x > 94 and x <= 97 then vetor = 5 elseif x > 97 and x <= 99 then vetor = 6 elseif x == 100 then vetor = 7 end local reward = config[vetor] if reward then doCreatureSay(cid, reward.msg, TALKTYPE_ORANGE_1) doPlayerAddItem(cid, reward.item, reward.count) doRemoveItem(cid, item.uid, 1) end return true end Nesse sistema eu teria que, por exemplo: o baú terá chance de 15 itens diferentes, então terei de configurar a porcentagem dos 15 itens completando 100% ao todo, é isso?
Postado Maio 19, 2015 10 anos a lógica é 100, mas tu faz a chance pelo numero que quiser. kkk STYLLER OT 2022
Postado Maio 19, 2015 10 anos Autor a lógica é 100, mas tu faz a chance pelo numero que quiser. kkk ah, tendi euheuhe reputado tbm, obg manin
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.