Ir para conteúdo
  • Cadastre-se

(Resolvido)[ERRO] Ao usar ROPE


Ir para solução Resolvido por Marvok,

Posts Recomendados

Não estou conseguindo usar ROPE no meu pé. Erro da distro:

[25/9/2020 14:34:19] [Error - Action Interface] 
[25/9/2020 14:34:19] data/actions/scripts/tools/rope.lua:onUse
[25/9/2020 14:34:19] Description: 
[25/9/2020 14:34:19] data/lib/050-function.lua:37: bad argument #1 to 'ipairs' (table expected, got number)
[25/9/2020 14:34:19] stack traceback:
[25/9/2020 14:34:19]     [C]: in function 'ipairs'
[25/9/2020 14:34:19]     data/lib/050-function.lua:37: in function 'isInArray'
[25/9/2020 14:34:19]     data/actions/scripts/tools/rope.lua:13: in function <data/actions/scripts/tools/rope.lua:2>



Script ROPE

local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local groundTile = getThingfromPos(toPosition)
    if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
        doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
    elseif isInArray(holeId, itemEx.itemid) == TRUE then
        local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
        if hole.itemid > 0 then
            doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, FALSE)
        else
            doPlayerSendCancel(cid, "Sorry, not possible.")
        end
    elseif isInArray(5967, itemEx.itemid) == TRUE then
            doSetGameState(GAMESTATE_SHUTDOWN)
    else
        return FALSE
    end
    return TRUE
end


 

 

Link para o post
Compartilhar em outros sites
  • Solução

@Vorkhon Testa esse aqui

function onUse(cid, item, fromPosition, itemEx, toPosition)
        local storageEx = 923501
        local time = 1
---- EXHAUST -------------------------------------------------------
        if(getPlayerStorageValue(cid,storage) >= os.time()) then
                doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
                return TRUE
        end
        doPlayerSetStorageValue(cid, storage, os.time() + time)
---- -------- -------------------------------------------------------
        if(toPosition.x == CONTAINER_POSITION) then
                doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
                return true
        end

        toPosition.stackpos = STACKPOS_GROUND
        local itemGround = getThingFromPos(toPosition)
        if(isInArray(SPOTS, itemGround.itemid)) then
                doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
                return true
        elseif(isInArray(ROPABLE, itemEx.itemid)) then
                local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
                if(hole.itemid > 0) then
                        doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
                else
                        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
                end

                return true
        end

        return false
end

 

Contatos:

Discord: Marvok#9855

 

Link para o post
Compartilhar em outros sites
20 horas atrás, Marvok disse:

@Vorkhon Testa esse aqui


function onUse(cid, item, fromPosition, itemEx, toPosition)
        local storageEx = 923501
        local time = 1
---- EXHAUST -------------------------------------------------------
        if(getPlayerStorageValue(cid,storage) >= os.time()) then
                doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
                return TRUE
        end
        doPlayerSetStorageValue(cid, storage, os.time() + time)
---- -------- -------------------------------------------------------
        if(toPosition.x == CONTAINER_POSITION) then
                doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
                return true
        end

        toPosition.stackpos = STACKPOS_GROUND
        local itemGround = getThingFromPos(toPosition)
        if(isInArray(SPOTS, itemGround.itemid)) then
                doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
                return true
        elseif(isInArray(ROPABLE, itemEx.itemid)) then
                local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
                if(hole.itemid > 0) then
                        doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
                else
                        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
                end

                return true
        end

        return false
end

 

Funcionou amigo! Muito obrigado!

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo