Ir para conteúdo
  • Cadastre-se

(Resolvido)Pz


Ir para solução Resolvido por Snowsz,

Posts Recomendados

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+

Link para o post
Compartilhar em outros sites
  • Respostas 10
  • Created
  • Última resposta

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Posts

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 = getItemsIn

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!

Link para o post
Compartilhar em outros sites
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%
 

Link para o post
Compartilhar em outros sites
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. 

Link para o post
Compartilhar em outros sites

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%
 

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96846
    Tópicos
    519601
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo