Postado Maio 21, 2018 7 anos Galera, estou com uma action de box mas tem um probleminha.. A box só some se estiver na bag, se estiver no chão ela fica infinita, como resolvo isso? function onUse(cid, item, fromPosition, itemEx, toPosition) local rewarditems = { {id = 2472, chance = 17, count = 1}, -- start with the lowest chances {id = 8977, chance = 2, count = 1} } local box = 6509 --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
Postado Maio 21, 2018 7 anos function onUse(cid, item, fromPosition, itemEx, toPosition) local rewarditems = { {id = 2472, chance = 17, count = 1}, -- start with the lowest chances {id = 8977, chance = 2, count = 1} } local box = 6509 --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) doRemoveItem(item.uid) 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
Postado Maio 21, 2018 7 anos Autor 4 horas atrás, Sttorm disse: function onUse(cid, item, fromPosition, itemEx, toPosition) local rewarditems = { {id = 2472, chance = 17, count = 1}, -- start with the lowest chances {id = 8977, chance = 2, count = 1} } local box = 6509 --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) doRemoveItem(item.uid) 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 Funcionou, só tem um problema cara eu tenho que clicar várias vezes pra box abrir, sabe o por que?
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.