Postado Junho 16, 2017 7 anos Spoiler local xhelds = { [1] = {name = "X-Attack(Tier: 1)"}, [2] = {name = "X-Attack(Tier: 2)"}, [3] = {name = "X-Attack(Tier: 3)"}, [4] = {name = "X-Attack(Tier: 4)"}, [5] = {name = "X-Attack(Tier: 5)"}, [6] = {name = "X-Attack(Tier: 6)"}, [7] = {name = "X-Attack(Tier: 7)"}, } local yhelds = { [1] = {name = "X-Defense(Tier: 1)"}, [2] = {name = "X-Defense(Tier: 2)"}, [3] = {name = "X-Defense(Tier: 3)"}, [4] = {name = "X-Defense(Tier: 4)"}, [5] = {name = "X-Defense(Tier: 5)"}, [6] = {name = "X-Defense(Tier: 6)"}, [7] = {name = "X-Defense(Tier: 7)"}, } local zhelds = { [1] = {name = "Z-Regeneration(Tier: 1)"}, [2] = {name = "Z-Regeneration(Tier: 2)"}, [3] = {name = "Z-Regeneration(Tier: 3)"}, [4] = {name = "Z-Regeneration(Tier: 4)"}, [5] = {name = "Z-Regeneration(Tier: 5)"}, [6] = {name = "Z-Regeneration(Tier: 6)"}, [7] = {name = "Z-Regeneration(Tier: 7)"}, [8] = {name = "Z-Cure(Tier: 1)"}, [9] = {name = "Z-Cure(Tier: 2)"}, [10] = {name = "Z-Cure(Tier: 3)"}, [11] = {name = "Z-Cure(Tier: 4)"}, [12] = {name = "Z-Cure(Tier: 5)"}, [13] = {name = "Z-Cure(Tier: 6)"}, [14] = {name = "Z-Cure(Tier: 7)"}, } function onTradeRequest(cid, target, item) for a, b in pairs (pokeballs) do if b.use == item.itemid then doPlayerSendCancel(cid, "You can't trade this item.") return false end end if isContainer(item.uid) then local bagItems = getItensUniquesInContainer(item.uid) if #bagItems >= 1 then doPlayerSendCancel(cid, "Has a Unique Item in this bag, you can't trade this item.") --alterado v1.6 return false end elseif getItemAttribute(item.uid, "unique") then --alterado v1.6 doPlayerSendCancel(cid, "It is a Unique Item, you can't trade this item.") return false end if isContainer(item.uid) then local itens = getPokeballsInContainer(item.uid) if #itens >= 1 then for i = 1, #itens do local lvl = getItemAttribute(itens, "level") local name = getItemAttribute(itens, "poke") if not lvl then doItemSetAttribute(itens, "level", pokes[name].level) --alterado v1.6 end end end elseif isPokeball(item.itemid) then local lvl = getItemAttribute(item.uid, "level") local name = getItemAttribute(item.uid, "poke") if not lvl then doItemSetAttribute(item.uid, "level", pokes[name].level) end end if getPlayerStorageValue(cid, 52480) >= 1 then --alterado v1.6.1 doPlayerSendTextMessage(cid, 20, "You can't do that while be in a duel!") return false end if isPokeball(item.itemid) then local name = getItemAttribute(item.uid, "poke") --alterado v1.8 \/ local boost = getItemAttribute(item.uid, "boost") or 0 local nick = getItemAttribute(item.uid, "nick") or "" local str = "Pokemon in trade: " str = str.."•Name: "..name.." •Boost: "..boost.." " if nick ~= "" then str = str.."•Nick: "..nick.."" end local heldx = getItemAttribute(item.uid, "heldx") local heldy = getItemAttribute(item.uid, "heldy") local heldy = getItemAttribute(item.uid, "heldz") if heldx and heldy and heldz thenstr = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". "if heldx and heldy thenstr = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name)..". "if heldx and heldz thenstr = str.."Holding: "..(xhelds[heldx].name).." and "..(zhelds[heldz].name)..". "if heldy and heldz thenstr = str.."Holding: "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". "elseif heldx thenstr = str.."Holding: "..(xhelds[heldx].name)..". "elseif heldy thenstr = str.."Holding: "..(yhelds[heldy].name)..". "end sendMsgToPlayer(target, 20, str) end --alterado v1.8 \/ if isContainer(item.uid) then local itens = getPokeballsInContainer(item.uid) if #itens >= 1 then for i = 1, #itens do if isPokeball(getThing(itens).itemid) then local name = getItemAttribute(itens, "poke") local boost = getItemAttribute(itens, "boost") or 0 local nick = getItemAttribute(itens, "nick") or "" local heldx = getItemAttribute(itens, "heldx") local heldy = getItemAttribute(itens, "heldy") local heldy = getItemAttribute(itens, "heldz") local str = "Pokemon in trade: " str = str.."•Name: "..name.." •Boost: "..boost.." " if nick ~= "" then str = str.."•Nick: "..nick.."" end if heldx and heldy and heldz thenstr = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". "if heldx and heldy thenstr = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name)..". "if heldx and heldz thenstr = str.."Holding: "..(xhelds[heldx].name).." and "..(zhelds[heldz].name)..". "if heldy and heldz thenstr = str.."Holding: "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". "elseif heldx thenstr = str.."Holding: "..(xhelds[heldx].name)..". "elseif heldy thenstr = str.."Holding: "..(yhelds[heldy].name)..". "end sendMsgToPlayer(target, 20, str) end end end end return trueend local function noCap(cid, sid) if isCreature(cid) then doPlayerSendCancel(cid, "You can't carry more than six pokemons, trade cancelled.") end if isCreature(sid) then doPlayerSendCancel(sid, "You can't carry more than six pokemons, trade cancelled.") endend function onTradeAccept(cid, target, item, targetItem) local pbs = #getPokeballsInContainer(item.uid) local cancel = false local p1 = 0 local p2 = 0 local itemPokeball = isPokeball(item.itemid) and 1 or 0 local targetItemPokeball = isPokeball(targetItem.itemid) and 1 or 0 if getPlayerMana(cid) + itemPokeball > 6 then --alterado v1.6 cancel = true p1 = cid end if getPlayerMana(target) + targetItemPokeball > 6 then --alterado v1.6 cancel = true p2 = target end if pbs > 0 and getCreatureMana(target) + pbs > 6 + targetItemPokeball then cancel = true p1 = target end pbs = #getPokeballsInContainer(targetItem.uid) if pbs > 0 and getCreatureMana(cid) + pbs > 6 + itemPokeball then cancel = true p2 = cid end if cancel then addEvent(noCap, 20, p1, p2) return false end if itemPokeball == 1 and targetItemPokeball == 1 then setPlayerStorageValue(cid, 8900, 1) setPlayerStorageValue(target, 8900, 1) end return trueend https://prnt.sc/fkplmr Editado Junho 16, 2017 7 anos por fillipek2 (veja o histórico de edições)
Postado Junho 16, 2017 7 anos Solução @fillipek2 tava faltando muitos ends para finalizar alguns blocos, adicionei conforme eu vi que estava fechando corretamente, porém não sei se tem alguma contradição, quê no caso seria uma else ou elseif, que e uma segunda opção caso não caia no if. Spoiler local xhelds = { [1] = {name = "X-Attack(Tier: 1)"}, [2] = {name = "X-Attack(Tier: 2)"}, [3] = {name = "X-Attack(Tier: 3)"}, [4] = {name = "X-Attack(Tier: 4)"}, [5] = {name = "X-Attack(Tier: 5)"}, [6] = {name = "X-Attack(Tier: 6)"}, [7] = {name = "X-Attack(Tier: 7)"}, } local yhelds = { [1] = {name = "X-Defense(Tier: 1)"}, [2] = {name = "X-Defense(Tier: 2)"}, [3] = {name = "X-Defense(Tier: 3)"}, [4] = {name = "X-Defense(Tier: 4)"}, [5] = {name = "X-Defense(Tier: 5)"}, [6] = {name = "X-Defense(Tier: 6)"}, [7] = {name = "X-Defense(Tier: 7)"}, } local zhelds = { [1] = {name = "Z-Regeneration(Tier: 1)"}, [2] = {name = "Z-Regeneration(Tier: 2)"}, [3] = {name = "Z-Regeneration(Tier: 3)"}, [4] = {name = "Z-Regeneration(Tier: 4)"}, [5] = {name = "Z-Regeneration(Tier: 5)"}, [6] = {name = "Z-Regeneration(Tier: 6)"}, [7] = {name = "Z-Regeneration(Tier: 7)"}, [8] = {name = "Z-Cure(Tier: 1)"}, [9] = {name = "Z-Cure(Tier: 2)"}, [10] = {name = "Z-Cure(Tier: 3)"}, [11] = {name = "Z-Cure(Tier: 4)"}, [12] = {name = "Z-Cure(Tier: 5)"}, [13] = {name = "Z-Cure(Tier: 6)"}, [14] = {name = "Z-Cure(Tier: 7)"}, } function onTradeRequest(cid, target, item) for a, b in pairs (pokeballs) do if b.use == item.itemid then doPlayerSendCancel(cid, "You can't trade this item.") return false end end if isContainer(item.uid) then local bagItems = getItensUniquesInContainer(item.uid) if #bagItems >= 1 then doPlayerSendCancel(cid, "Has a Unique Item in this bag, you can't trade this item.") --alterado v1.6 return false end elseif getItemAttribute(item.uid, "unique") then --alterado v1.6 doPlayerSendCancel(cid, "It is a Unique Item, you can't trade this item.") return false end if isContainer(item.uid) then local itens = getPokeballsInContainer(item.uid) if #itens >= 1 then for i = 1, #itens do local lvl = getItemAttribute(itens, "level") local name = getItemAttribute(itens, "poke") if not lvl then doItemSetAttribute(itens, "level", pokes[name].level) --alterado v1.6 end end end elseif isPokeball(item.itemid) then local lvl = getItemAttribute(item.uid, "level") local name = getItemAttribute(item.uid, "poke") if not lvl then doItemSetAttribute(item.uid, "level", pokes[name].level) end end if getPlayerStorageValue(cid, 52480) >= 1 then --alterado v1.6.1 doPlayerSendTextMessage(cid, 20, "You can't do that while be in a duel!") return false end if isPokeball(item.itemid) then local name = getItemAttribute(item.uid, "poke") --alterado v1.8 \/ local boost = getItemAttribute(item.uid, "boost") or 0 local nick = getItemAttribute(item.uid, "nick") or "" local str = "Pokemon in trade: " str = str.."•Name: "..name.." •Boost: "..boost.." " if nick ~= "" then str = str.."•Nick: "..nick.."" end local heldx = getItemAttribute(item.uid, "heldx") local heldy = getItemAttribute(item.uid, "heldy") local heldy = getItemAttribute(item.uid, "heldz") if heldx and heldy and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " if heldx and heldy then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name)..". " if heldx and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(zhelds[heldz].name)..". " if heldy and heldz then str = str.."Holding: "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " elseif heldx then str = str.."Holding: "..(xhelds[heldx].name)..". " elseif heldy then str = str.."Holding: "..(yhelds[heldy].name)..". " end sendMsgToPlayer(target, 20, str) end --alterado v1.8 \/ if isContainer(item.uid) then local itens = getPokeballsInContainer(item.uid) if #itens >= 1 then for i = 1, #itens do if isPokeball(getThing(itens).itemid) then local name = getItemAttribute(itens, "poke") local boost = getItemAttribute(itens, "boost") or 0 local nick = getItemAttribute(itens, "nick") or "" local heldx = getItemAttribute(itens, "heldx") local heldy = getItemAttribute(itens, "heldy") local heldy = getItemAttribute(itens, "heldz") local str = "Pokemon in trade: " str = str.."•Name: "..name.." •Boost: "..boost.." " if nick ~= "" then str = str.."•Nick: "..nick.."" end if heldx and heldy and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " if heldx and heldy then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name)..". " if heldx and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(zhelds[heldz].name)..". " if heldy and heldz then str = str.."Holding: "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " elseif heldx then str = str.."Holding: "..(xhelds[heldx].name)..". " elseif heldy then str = str.."Holding: "..(yhelds[heldy].name)..". " end sendMsgToPlayer(target, 20, str) end end end end end end end end end end return true end local function noCap(cid, sid) if isCreature(cid) then doPlayerSendCancel(cid, "You can't carry more than six pokemons, trade cancelled.") end if isCreature(sid) then doPlayerSendCancel(sid, "You can't carry more than six pokemons, trade cancelled.") end end function onTradeAccept(cid, target, item, targetItem) local pbs = #getPokeballsInContainer(item.uid) local cancel = false local p1 = 0 local p2 = 0 local itemPokeball = isPokeball(item.itemid) and 1 or 0 local targetItemPokeball = isPokeball(targetItem.itemid) and 1 or 0 if getPlayerMana(cid) + itemPokeball > 6 then --alterado v1.6 cancel = true p1 = cid end if getPlayerMana(target) + targetItemPokeball > 6 then --alterado v1.6 cancel = true p2 = target end if pbs > 0 and getCreatureMana(target) + pbs > 6 + targetItemPokeball then cancel = true p1 = target end pbs = #getPokeballsInContainer(targetItem.uid) if pbs > 0 and getCreatureMana(cid) + pbs > 6 + itemPokeball then cancel = true p2 = cid end if cancel then addEvent(noCap, 20, p1, p2) return false end if itemPokeball == 1 and targetItemPokeball == 1 then setPlayerStorageValue(cid, 8900, 1) setPlayerStorageValue(target, 8900, 1) end return true end
Postado Junho 16, 2017 7 anos Autor 17 minutos atrás, KotZletY disse: @fillipek2 tava faltando muitos ends para finalizar alguns blocos, adicionei conforme eu vi que estava fechando corretamente, porém não sei se tem alguma contradição, quê no caso seria uma else ou elseif, que e uma segunda opção caso não caia no if. Ocultar conteúdo local xhelds = { [1] = {name = "X-Attack(Tier: 1)"}, [2] = {name = "X-Attack(Tier: 2)"}, [3] = {name = "X-Attack(Tier: 3)"}, [4] = {name = "X-Attack(Tier: 4)"}, [5] = {name = "X-Attack(Tier: 5)"}, [6] = {name = "X-Attack(Tier: 6)"}, [7] = {name = "X-Attack(Tier: 7)"}, } local yhelds = { [1] = {name = "X-Defense(Tier: 1)"}, [2] = {name = "X-Defense(Tier: 2)"}, [3] = {name = "X-Defense(Tier: 3)"}, [4] = {name = "X-Defense(Tier: 4)"}, [5] = {name = "X-Defense(Tier: 5)"}, [6] = {name = "X-Defense(Tier: 6)"}, [7] = {name = "X-Defense(Tier: 7)"}, } local zhelds = { [1] = {name = "Z-Regeneration(Tier: 1)"}, [2] = {name = "Z-Regeneration(Tier: 2)"}, [3] = {name = "Z-Regeneration(Tier: 3)"}, [4] = {name = "Z-Regeneration(Tier: 4)"}, [5] = {name = "Z-Regeneration(Tier: 5)"}, [6] = {name = "Z-Regeneration(Tier: 6)"}, [7] = {name = "Z-Regeneration(Tier: 7)"}, [8] = {name = "Z-Cure(Tier: 1)"}, [9] = {name = "Z-Cure(Tier: 2)"}, [10] = {name = "Z-Cure(Tier: 3)"}, [11] = {name = "Z-Cure(Tier: 4)"}, [12] = {name = "Z-Cure(Tier: 5)"}, [13] = {name = "Z-Cure(Tier: 6)"}, [14] = {name = "Z-Cure(Tier: 7)"}, } function onTradeRequest(cid, target, item) for a, b in pairs (pokeballs) do if b.use == item.itemid then doPlayerSendCancel(cid, "You can't trade this item.") return false end end if isContainer(item.uid) then local bagItems = getItensUniquesInContainer(item.uid) if #bagItems >= 1 then doPlayerSendCancel(cid, "Has a Unique Item in this bag, you can't trade this item.") --alterado v1.6 return false end elseif getItemAttribute(item.uid, "unique") then --alterado v1.6 doPlayerSendCancel(cid, "It is a Unique Item, you can't trade this item.") return false end if isContainer(item.uid) then local itens = getPokeballsInContainer(item.uid) if #itens >= 1 then for i = 1, #itens do local lvl = getItemAttribute(itens, "level") local name = getItemAttribute(itens, "poke") if not lvl then doItemSetAttribute(itens, "level", pokes[name].level) --alterado v1.6 end end end elseif isPokeball(item.itemid) then local lvl = getItemAttribute(item.uid, "level") local name = getItemAttribute(item.uid, "poke") if not lvl then doItemSetAttribute(item.uid, "level", pokes[name].level) end end if getPlayerStorageValue(cid, 52480) >= 1 then --alterado v1.6.1 doPlayerSendTextMessage(cid, 20, "You can't do that while be in a duel!") return false end if isPokeball(item.itemid) then local name = getItemAttribute(item.uid, "poke") --alterado v1.8 \/ local boost = getItemAttribute(item.uid, "boost") or 0 local nick = getItemAttribute(item.uid, "nick") or "" local str = "Pokemon in trade: " str = str.."•Name: "..name.." •Boost: "..boost.." " if nick ~= "" then str = str.."•Nick: "..nick.."" end local heldx = getItemAttribute(item.uid, "heldx") local heldy = getItemAttribute(item.uid, "heldy") local heldy = getItemAttribute(item.uid, "heldz") if heldx and heldy and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " if heldx and heldy then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name)..". " if heldx and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(zhelds[heldz].name)..". " if heldy and heldz then str = str.."Holding: "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " elseif heldx then str = str.."Holding: "..(xhelds[heldx].name)..". " elseif heldy then str = str.."Holding: "..(yhelds[heldy].name)..". " end sendMsgToPlayer(target, 20, str) end --alterado v1.8 \/ if isContainer(item.uid) then local itens = getPokeballsInContainer(item.uid) if #itens >= 1 then for i = 1, #itens do if isPokeball(getThing(itens).itemid) then local name = getItemAttribute(itens, "poke") local boost = getItemAttribute(itens, "boost") or 0 local nick = getItemAttribute(itens, "nick") or "" local heldx = getItemAttribute(itens, "heldx") local heldy = getItemAttribute(itens, "heldy") local heldy = getItemAttribute(itens, "heldz") local str = "Pokemon in trade: " str = str.."•Name: "..name.." •Boost: "..boost.." " if nick ~= "" then str = str.."•Nick: "..nick.."" end if heldx and heldy and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " if heldx and heldy then str = str.."Holding: "..(xhelds[heldx].name).." and "..(yhelds[heldy].name)..". " if heldx and heldz then str = str.."Holding: "..(xhelds[heldx].name).." and "..(zhelds[heldz].name)..". " if heldy and heldz then str = str.."Holding: "..(yhelds[heldy].name).." and "..(zhelds[heldz].name)..". " elseif heldx then str = str.."Holding: "..(xhelds[heldx].name)..". " elseif heldy then str = str.."Holding: "..(yhelds[heldy].name)..". " end sendMsgToPlayer(target, 20, str) end end end end end end end end end end return true end local function noCap(cid, sid) if isCreature(cid) then doPlayerSendCancel(cid, "You can't carry more than six pokemons, trade cancelled.") end if isCreature(sid) then doPlayerSendCancel(sid, "You can't carry more than six pokemons, trade cancelled.") end end function onTradeAccept(cid, target, item, targetItem) local pbs = #getPokeballsInContainer(item.uid) local cancel = false local p1 = 0 local p2 = 0 local itemPokeball = isPokeball(item.itemid) and 1 or 0 local targetItemPokeball = isPokeball(targetItem.itemid) and 1 or 0 if getPlayerMana(cid) + itemPokeball > 6 then --alterado v1.6 cancel = true p1 = cid end if getPlayerMana(target) + targetItemPokeball > 6 then --alterado v1.6 cancel = true p2 = target end if pbs > 0 and getCreatureMana(target) + pbs > 6 + targetItemPokeball then cancel = true p1 = target end pbs = #getPokeballsInContainer(targetItem.uid) if pbs > 0 and getCreatureMana(cid) + pbs > 6 + itemPokeball then cancel = true p2 = cid end if cancel then addEvent(noCap, 20, p1, p2) return false end if itemPokeball == 1 and targetItemPokeball == 1 then setPlayerStorageValue(cid, 8900, 1) setPlayerStorageValue(target, 8900, 1) end return true end Perfeito funcionou aqui muito obrigado mesmo!
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.