Ir para conteúdo

Featured Replies

Postado

Ids ? 

 

function onUse(cid, item, frompos, item2, topos)
    if item.uid == 60000  and getPlayerStorageValue(cid,60000) == -1 and getPlayerStorageValue(cid,60001) == -1 and getPlayerStorageValue(cid,60002) == -1 and getPlayerStorageValue(cid,60003) == -1 and getPlayerStorageValue(cid,60004) == -1  then
            doPlayerSendTextMessage(cid,25,"You have found a item.")
            doPlayerAddItem(cid,1987,1)            
            setPlayerStorageValue(cid,60000,1)
        else
            doPlayerSendTextMessage(cid,25,"It is empty.")
        end
    end
    return true
end

function onUse(cid, item, frompos, item2, topos)
    if item.uid == 60001 and getPlayerStorageValue(cid,60000) == -1 and getPlayerStorageValue(cid,60001) == -1 and getPlayerStorageValue(cid,60002) == -1 and getPlayerStorageValue(cid,60003) == -1 and getPlayerStorageValue(cid,60004) == -1  then
            doPlayerSendTextMessage(cid,25,"You have found a item.")
            doPlayerAddItem(cid,1987,1)
            setPlayerStorageValue(cid,60001,1)
        else
            doPlayerSendTextMessage(cid,25,"It is empty.")
        end
    end
    return true
end


function onUse(cid, item, frompos, item2, topos)
    if item.uid == 60002 and getPlayerStorageValue(cid,60000) == -1 and getPlayerStorageValue(cid,60001) == -1 and getPlayerStorageValue(cid,60002) == -1 and getPlayerStorageValue(cid,60003) == -1 and getPlayerStorageValue(cid,60004) == -1  then
            doPlayerSendTextMessage(cid,25,"You have found a item.")
            doPlayerAddItem(cid,1987,1)
             setPlayerStorageValue(cid,60002,1)
        else
            doPlayerSendTextMessage(cid,25,"It is empty.")
        end
    end
    return true
end


function onUse(cid, item, frompos, item2, topos)
    if item.uid == 60003 and getPlayerStorageValue(cid,60000) == -1 and getPlayerStorageValue(cid,60001) == -1 and getPlayerStorageValue(cid,60002) == -1 and getPlayerStorageValue(cid,60003) == -1 and getPlayerStorageValue(cid,60004) == -1  then
           doPlayerSendTextMessage(cid,25,"You have found a item.")
           doPlayerAddItem(cid,1987,1)
           setPlayerStorageValue(cid,60003,1)
        else
            doPlayerSendTextMessage(cid,25,"It is empty.")
        end
    end
    return true
end

function onUse(cid, item, frompos, item2, topos)
    if item.uid == 60004 and getPlayerStorageValue(cid,60000) == -1 and getPlayerStorageValue(cid,60001) == -1 and getPlayerStorageValue(cid,60002) == -1 and getPlayerStorageValue(cid,60003) == -1 and getPlayerStorageValue(cid,60004) == -1  then
		
            doPlayerSendTextMessage(cid,25,"You have found a item.")
           doPlayerAddItem(cid,1987,1)
             setPlayerStorageValue(cid,60004,1)
        else
            doPlayerSendTextMessage(cid,25,"It is empty.")
        end
    end
    return true
end

 
<action uniqueid="60000;60001;60002;60003;60004" event="script" value="questcincoitems.lua"/>

Vê se funciona.


Não se esqueça de alterar o id em:

doPlayerAddItem(cid,1987,1)

Caso contrário, os três baús darão os mesmos items.

 

para adicionar o crosbow e arrow no mesmo baú é só adicionar mais uma linha de doplayeradditem, em baixo da mesma...

Editado por Caronte (veja o histórico de edições)

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


Mostrar conteúdo oculto

 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

  • Respostas 12
  • Visualizações 2.9k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Alteração no código: function onUse(cid, item, frompos, item2, topos)     if item.uid == 60003 then         if getPlayerStorageValue(cid,60003) == -1 then             doPlayerSendTextMessage(cid,25,

  • Sua alteração funcionou perfeitamente, vou te reputar, e aguardar pelo o pedido...

  • Ou você pode usar esse código: local items = {     [actionid] = itemid,     [actionid] = itemid,     [actionid] = itemid,     [actionid] = itemid,     [actionid] = {itemid, itemid}, } local storage

Postado
  • Autor

Nada, tem que ser também uma unica UNIQUEID, no caso 60002, essas outras eu uso em outras quest

Editado por jNo (veja o histórico de edições)

(1º) | [8.60] - Galaxy Server - Download

(2º) | [8.60] - Glorious Server - Download

(3º) | [8.60] - Epic Server - Download

Postado

Ou você pode usar esse código:

local items = {
    [actionid] = itemid,
    [actionid] = itemid,
    [actionid] = itemid,
    [actionid] = itemid,
    [actionid] = {itemid, itemid},
}
local storage = 7601
function onUse(cid, item, frompos, item2, topos)
    if items[item.actionid] then
        if getPlayerStorageValue(cid, storage) < 1 then
            local _item = items[item.actionid]
            if type(_item) == "table" then
                for i = 1, #_item do
                    doPlayerAddItem(cid, _item[i], 1)
                end
            else
                doPlayerAddItem(cid, _item, 1)
            end
            doPlayerSendTextMessage(cid, 27, "Hey, you found something!")
            setPlayerStorageValue(cid, storage, 1)
        else
            return doPlayerSendCancel(cid, "You already got your item.")
        end
    end
    return true
end
Cada baú, 1 actionid. Não se esqueça de configurar a tabela items. Na tag, você coloca as actionids (serão 5, no total).
Se preferir, você pode optar pelo seguinte código:
local items = {
    [{x = x, y = y, z = z}] = itemid,           --  [{posição do baú}] = id do item,
    [{x = x, y = y, z = z}] = itemid,
    [{x = x, y = y, z = z}] = itemid,
    [{x = x, y = y, z = z}] = itemid,
    [{x = x, y = y, z = z}] = {itemid, itemid},
}
local storage = 7601
function onUse(cid, item, frompos, item2, topos)
    if items[topos] then
        if getPlayerStorageValue(cid, storage) < 1 then
            local _item = items[topos]
            if type(_item) == "table" then
                for i = 1, #_item do
                    doPlayerAddItem(cid, _item[i], 1)
                end
            else
                doPlayerAddItem(cid, _item, 1)
            end
            doPlayerSendTextMessage(cid, 27, "Hey, you found something!")
            setPlayerStorageValue(cid, storage, 1)
        else
            return doPlayerSendCancel(cid, "You already got your item.")
        end
    end
    return true
end
Dessa vez, é apenas 1 actionid para todos os baús. Eu indiquei no código como configurar a tabela items. Qualquer dúvida, só falar.
 
agr que li que vc queria com uniqueid. mas enfim, se alguém quiser usar aid, tá aí ;s

Editado por zipter98 (veja o histórico de edições)

não respondo pms solicitando suporte em programação/scripting

Postado

??

 

Como assim nada ? 

Sò mudar para umas que você não tem.

Já que você quer só um uniqueid:

function onUse(cid, item, frompos, item2, topos)
    

local i = {IDsorc, IDdruid, IDpala, IDkina}
local msg = {"You found a item","It's empty"}

if item.uid == 60000 and getPlayerStorageValue(cid,storage) == -1 then
doPlayerAddItem(cid,i[getPlayerVocation(cid)],1)
setPlayerStorageValue(cid,60000,1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,msg[1])
else
doPlayerSendCancel(cid,msg[2])
end
return true
end

Editado por Caronte (veja o histórico de edições)

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


Mostrar conteúdo oculto

 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

Postado
  • Autor

@Zipter98 deu esse erro no 1 script, no 2 nem pegou.

 

M8iIfjL.png

 

@Carionte, no seu 1 script deu esse erro, também optarei por usar uniquesid diferente vai facilitar por aqui deu erro no distro de duplicate ID

 

 

RNn2rxh.png

 

 

Estou usando assim o Action, coloquei uniqueid por uniqueid já nos bau.

<action uniqueid="60002;60003;60004;60005;60006" event="script" value="questvipacess/bauweapons.lua"/>

(1º) | [8.60] - Galaxy Server - Download

(2º) | [8.60] - Glorious Server - Download

(3º) | [8.60] - Epic Server - Download

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo