Postado Maio 28, 2015 10 anos Olá, gostaria de pedir que vocês adicionassem a função do player só poder usar tal item se não estiver com "pk" ou com pz locked e tal, enfim... Script: 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) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function onUse(cid) 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 Obrigado, REP+
Postado Maio 28, 2015 10 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)) then doPlayerSendCancel(cid, "Você não pode passar aqui 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 _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Maio 28, 2015 10 anos 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 doPlayerSendCancel(cid, "Voce nao pode usar pk, nem com battle.") return true 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 www.pokemiw.com 24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
Postado Maio 28, 2015 10 anos Autor 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)) then doPlayerSendCancel(cid, "Você não pode passar aqui 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 Tipo, funcionou a questão do pk e tal, porém se o player estiver com aquela "espadinha vermelha" ele passa... 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 doPlayerSendCancel(cid, "Voce nao pode usar pk, nem com battle.") return true 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 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.
Postado Maio 28, 2015 10 anos 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 www.pokemiw.com 24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
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.