Poke X Ice 52 Posted September 13, 2018 Report Share Posted September 13, 2018 Basicamente estou com um simples problema no meu script! qual seria? quando um player ganha um item da parte da tabela está adicionando 3 item na tabela na bag. então eu queria que só adicionasse 1 item da tabela! cada item tem sua porcentagem mas no caso eu queria adicionasse um item só. quando um player ganhasse. Servidor Versão:0.3.6 Tabela: local cfg = { [2160] = {chance = 50, quantidade = 50, description = "Dinheiro"}, [2159] = {chance = 40, quantidade = 1, description = "Gold Bar"}, [2158] = {chance = 30, quantidade = 1, description = "Blue Gem"} } Script foi feita por Mim. sou um pouco iniciante na área Spoiler local cfg = { [2160] = {chance = 50, quantidade = 50, description = "Dinheiro"}, [2159] = {chance = 40, quantidade = 1, description = "Gold Bar"}, [2158] = {chance = 30, quantidade = 1, description = "Blue Gem"} } pos = {x = 1052, y = 1049, z = 7} -- position cp de saffron function onUse(cid, itemId, itemEx) for k,v in pairs(cfg) do local valor = math.random(1, 100) if getGlobalStorageValue(cid, 12389) == 1 then else doTeleportThing(cid, pos) doPlayerSendCancel(cid, "[Evento Bag] esta fechado") return true end if v.chance >= valor then doPlayerAddItem(cid, k, v.quantidade) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Win-Bag-Event] \n premio:["..v.description.."]") doTeleportThing(cid, pos) else doTeleportThing(cid, pos) doCreatureSay(cid, 'Falhou Meu Guerreiro', TALKTYPE_ORANGE_1) return true end end end Link to comment https://xtibia.com/forum/topic/248215-encerrado-erro-script-evento-bag/ Share on other sites More sharing options...
Crypter 136 Posted September 19, 2018 Report Share Posted September 19, 2018 local cfg = { [2160] = {chance = 50, quantidade = 50, description = "Dinheiro"}, [2159] = {chance = 40, quantidade = 1, description = "Gold Bar"}, [2158] = {chance = 30, quantidade = 1, description = "Blue Gem"} } local pos = {x = 1052, y = 1049, z = 7} -- position cp de saffron local win = false function onUse(cid, itemId, itemEx) if not getGlobalStorageValue(cid, 12389) == 1 then doTeleportThing(cid, pos) doPlayerSendCancel(cid, "[Evento Bag] esta fechado") return true end for k,v in pairs(cfg) do if v.chance >= math.random(1, 100) then doPlayerAddItem(cid, k, v.quantidade) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Win-Bag-Event] \n premio:["..v.description.."]") win = true break end end doTeleportThing(cid, pos) if not win then doCreatureSay(cid, 'Falhou Meu Guerreiro', TALKTYPE_ORANGE_1) end return true end Link to comment https://xtibia.com/forum/topic/248215-encerrado-erro-script-evento-bag/#findComment-1743951 Share on other sites More sharing options...
Benny 735 Posted February 20, 2019 Report Share Posted February 20, 2019 A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta. + Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda. * Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado. Link to comment https://xtibia.com/forum/topic/248215-encerrado-erro-script-evento-bag/#findComment-1748819 Share on other sites More sharing options...
Recommended Posts