Postado Maio 28, 2015 9 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: 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. 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 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)) 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
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. 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
Postado Maio 28, 2015 9 anos Autor Em 28/05/2015 em 00:52, 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)) 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... Em 28/05/2015 em 00:55, klipstyle disse: 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 9 anos 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
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.