• 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!

Solved Closing Doors = Server Freeze

GM Venom

Active Member
Joined
Jan 28, 2013
Messages
145
Reaction score
28
Solved it myself. close plz :)
recoded lua s
 
Last edited:
Code:
function onStepOut(cid, item, position, fromPosition)
    if(getTileInfo(position).creatures > 0) then
        return true
    end

    local newPosition = {x = position.x, y = position.y, z = position.z}
    if(isInArray(verticalOpenDoors, item.itemid)) then
        newPosition.x = newPosition.x + 1
    else
        newPosition.y = newPosition.y + 1
    end

    doRelocate(position, newPosition)
    local tmpPos = position
    tmpPos.stackpos = -1

    local i, tmpItem, tileCount = 1, {uid = 1}, getTileThingByPos(tmpPos)
    while(tmpItem.uid ~= 0 and i < tileCount) do
        tmpPos.stackpos = i
        tmpItem = getTileThingByPos(tmpPos)
        if(tmpItem.uid ~= item.uid and tmpItem.uid ~= 0 and isMoveable(tmpItem.uid)) then
            doRemoveItem(tmpItem.uid)
        else
            i = i + 1
        end
    end

    doTransformItem(item.uid, item.itemid - 1)
    return true
end
 
Code:
function onStepOut(cid, item, position, fromPosition)
    if(getTileInfo(position).creatures > 0) then
        return true
    end

    local newPosition = {x = position.x, y = position.y, z = position.z}
    if(isInArray(verticalOpenDoors, item.itemid)) then
        newPosition.x = newPosition.x + 1
    else
        newPosition.y = newPosition.y + 1
    end

    doRelocate(position, newPosition)
    local tmpPos = position
    tmpPos.stackpos = -1

    local i, tmpItem, tileCount = 1, {uid = 1}, getTileThingByPos(tmpPos)
    while(tmpItem.uid ~= 0 and i < tileCount) do
        tmpPos.stackpos = i
        tmpItem = getTileThingByPos(tmpPos)
        if(tmpItem.uid ~= item.uid and tmpItem.uid ~= 0 and isMoveable(tmpItem.uid)) then
            doRemoveItem(tmpItem.uid)
        else
            i = i + 1
        end
    end

    doTransformItem(item.uid, item.itemid - 1)
    return true
end

Now i get another error:
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/closingdoor.lua:onStepOut
data/movements/scripts/closingdoor.lua:2: attempt to call global 'getTileInfo' <a nil value>
stack traceback:
data/movements/scripts/closingdoor.lua:2: in function <data/movements/scripts/closingdoor.lua:1>

Atleast it didn't crash ... but the experience door wont close behind me :(
 
Please do not remove the original question once you solve the problem.
Also, it would be kind to post your solutions for other people with a similar problem.
 
Back
Top