Postado Abril 29, 2016 9 anos Não esqueça de mudar o id da box no código. function onUse(cid, item, fromPosition, itemEx, toPosition) local rewarditems = { {id = 2472, chance = 17, count = 1}, -- start with the lowest chances {id = 2498, chance = 17, count = 1}, {id = 2645, chance = 17, count = 1}, {id = 2421, chance = 8, count = 1}, {id = 2514, chance = 13, count = 1}, -- start with the lowest chances {id = 2470, chance = 10, count = 1}, {id = 2646, chance = 5, count = 1}, {id = 2523, chance = 3, count = 1}, -- start with the lowest chances {id = 2522, chance = 4, count = 1}, {id = 2471, chance = 2, count = 1}, {id = 2496, chance = 2, count = 1}, {id = 8977, chance = 2, count = 1} } local box = xx --ID da box. local chance = math.random(1,100) for i = 1, #rewarditems, 1 do if(chance < rewarditems[i].chance) then local info = getItemInfo(rewarditems[i].id) if(rewarditems[i].count > 1) then text = rewarditems[i].count .. " " .. info.plural else text = info.article .. " " .. info.name end if item.itemid == box then doPlayerAddItem(cid, rewarditems[i].id, rewarditems[i].count) doPlayerRemoveItem(cid, box, 1) doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) text = "You have received " .. text .. "." else text = "You have failed to open your mystery box. The item is to heavy or you have not enough space to take it." end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text) return true else chance = chance - rewarditems[i].chance end end end Editado Abril 29, 2016 9 anos por Talesigorvr (veja o histórico de edições) Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
Postado Abril 29, 2016 9 anos Autor 3 minutos atrás, Talesigorvr disse: Não esqueça de mudar o id da box no código. function onUse(cid, item, fromPosition, itemEx, toPosition) local rewarditems = { {id = 2472, chance = 17, count = 1}, -- start with the lowest chances {id = 2498, chance = 17, count = 1}, {id = 2645, chance = 17, count = 1}, {id = 2421, chance = 8, count = 1}, {id = 2514, chance = 13, count = 1}, -- start with the lowest chances {id = 2470, chance = 10, count = 1}, {id = 2646, chance = 5, count = 1}, {id = 2523, chance = 3, count = 1}, -- start with the lowest chances {id = 2522, chance = 4, count = 1}, {id = 2471, chance = 2, count = 1}, {id = 2496, chance = 2, count = 1}, {id = 8977, chance = 2, count = 1} } local box = xx --ID da box. local chance = math.random(1,100) for i = 1, #rewarditems, 1 do if(chance < rewarditems[i].chance) then local info = getItemInfo(rewarditems[i].id) if(rewarditems[i].count > 1) then text = rewarditems[i].count .. " " .. info.plural else text = info.article .. " " .. info.name end if item.itemid == box then doPlayerAddItem(cid, rewarditems[i].id, rewarditems[i].count) doPlayerRemoveItem(cid, box, 1) doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) text = "You have received " .. text .. "." else text = "You have failed to open your mystery box. The item is to heavy or you have not enough space to take it." end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text) return true else chance = chance - rewarditems[i].chance end end end Nossa cara eu te amo , deu certo aqui, agora sapoha de box some kkkkk. Vlw msm cara. Rep+
Postado Abril 29, 2016 9 anos 15 minutos atrás, Gruly disse: Nossa cara eu te amo , deu certo aqui, agora sapoha de box some kkkkk. Vlw msm cara. Rep+ Np. =) Foi mal pela demora, tinha esquecido de te responder. Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
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.