• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

tfs 0.4 console error

pepzo

Member
Joined
Jan 18, 2009
Messages
198
Reaction score
7
[Error - Action Interface]
data/actions/scripts/other/keys.lua
Description:
data/actions/scripts/other/keys.lua:2: bad argument #1 to 'pairs' (table expected, got nil)
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/keys.lua)

and my keys.lua

Code:
REVERSE_DOORS, CHILD_DOORS = {}, {}
for k, v in pairs(DOORS) do
    REVERSE_DOORS[v] = k

    local tmp = getItemInfo(v)
    if(tmp.transformUseTo ~= 0) then
        CHILD_DOORS[tmp.transformUseTo] = k
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.aid > 0 and itemEx.aid > 0) then
        if(isPlayerPzLocked(cid) and getTileInfo(toPosition).protection) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
            return true
        end

        local doors = DOORS[itemEx.itemid]
        if(not doors) then
            doors = REVERSE_DOORS[itemEx.itemid]
        end

        if(not doors) then
            doors = CHILD_DOORS[itemEx.itemid]
        end

        if(doors) then
            if(item.actionid ~= itemEx.actionid) then
                doPlayerSendCancel(cid, "The key does not match.")
            else
                doTransformItem(itemEx.uid, doors)
            end

            return true
        end
    end

    return false
end

bump
 
Last edited by a moderator:
Back
Top