Postado Maio 28, 2015 9 anos local medalId = 5785 --ID da Medal of Honour. local toPosition = {x = 238, y = 256, z = 7} --Para onde o jogador será teleportado. function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function onUse(cid) if isInArray({SKULL_YELLOW, SKULL_WHITE, SKULL_RED, SKULL_BLACK}, getPlayerSkullType(cid)) or getCreatureCondition(cid, CONDITION_INFIGHT) then doPlayerSendCancel(cid, "Você não pode passar aqui em batalha ou com PK.") else if #getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, medalId) < 1 then local medalCheck for i = 1, 10 do if getPlayerSlotItem(cid, i).itemid == medalId then medalCheck = true break end end if not medalCheck then return doPlayerSendCancel(cid, "Você não pode passar aqui sem um "..getItemNameById(medalId)..".") end end doTeleportThing(cid, toPosition) end return true end
Postado Maio 28, 2015 9 anos Snowsz a verificação do "SKULL_RED, SKULL_BLACK" nao impediria players com skull sem battle? tipo peguei red morri ja to tranquilo sem battle "sem nada kkk"
Postado Maio 28, 2015 9 anos Em 28/05/2015 em 01:36, klipstyle disse: Snowsz a verificação do "SKULL_RED, SKULL_BLACK" nao impediria players com skull sem battle? tipo peguei red morri ja to tranquilo sem battle "sem nada kkk" Sim mas ele disse que também quer sem skull(não disse quais).
Postado Maio 28, 2015 9 anos Autor Em 28/05/2015 em 01:13, klipstyle disse: Mostrar conteúdo oculto Mostrar conteúdo oculto local medalId = 5785 --ID da Medal of Honour. local toPosition = {x = 238, y = 256, z = 7} --Para onde o jogador será teleportado. local config = { battle = true } function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function onUse(cid) if config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then return doPlayerSendCancel(cid, "Voce nao pode usar pk, nem com battle.") end if #getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, medalId) < 1 then local medalCheck for i = 1, 10 do if getPlayerSlotItem(cid, i).itemid == medalId then medalCheck = true break end end if not medalCheck then return doPlayerSendCancel(cid, "Você não pode passar aqui sem um "..getItemNameById(medalId)..".") end end doTeleportThing(cid, toPosition) return true end Mesma coisa... O seu funcionou tanto a questão do pk e da "espadinha vermelha", porém se o player estiver apenas com battle não passa e se não tiver nem com battle, ele clica na porta (porta com aid do script) e nada acontece. Em 28/05/2015 em 01:33, Snowsz disse: local medalId = 5785 --ID da Medal of Honour. local toPosition = {x = 238, y = 256, z = 7} --Para onde o jogador será teleportado. function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function onUse(cid) if isInArray({SKULL_YELLOW, SKULL_WHITE, SKULL_RED, SKULL_BLACK}, getPlayerSkullType(cid)) or getCreatureCondition(cid, CONDITION_INFIGHT) then doPlayerSendCancel(cid, "Você não pode passar aqui em batalha ou com PK.") else if #getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, medalId) < 1 then local medalCheck for i = 1, 10 do if getPlayerSlotItem(cid, i).itemid == medalId then medalCheck = true break end end if not medalCheck then return doPlayerSendCancel(cid, "Você não pode passar aqui sem um "..getItemNameById(medalId)..".") end end doTeleportThing(cid, toPosition) end return true end Funciona tudo certinho, porém ele só passa se não estiver nem com o "battle", tipo, a restrição seria apenas por pk's e pz's... Exemplo: Podem passar; black skull (sem pz, "espadinha vermelha, apenas ele logou e já estava black skull.) red skull (sem pz, "espadinha vermelha, apenas ele logou e já estava red skull.) battle (espadinha normal, sem ser a "espadinha vermelha", apenas aquela espadinha de como se você tivesse atacado ou sido atacado por um monstro/player) Não podem passar; pz locked (espadinha vermelha) white skull. É tipo isso, rs.
Postado Maio 28, 2015 9 anos Solução local medalId = 5785 --ID da Medal of Honour. local toPosition = {x = 238, y = 256, z = 7} --Para onde o jogador será teleportado. function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function onUse(cid) if getPlayerSkullType(cid) == SKULL_WHITE or isPlayerPzLocked(cid) then doPlayerSendCancel(cid, "Você não pode passar aqui com PZ Locked ou com PK.") else if #getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, medalId) < 1 then local medalCheck for i = 1, 10 do if getPlayerSlotItem(cid, i).itemid == medalId then medalCheck = true break end end if not medalCheck then return doPlayerSendCancel(cid, "Você não pode passar aqui sem um "..getItemNameById(medalId)..".") end end doTeleportThing(cid, toPosition) end return true end
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.