• 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 1.X+ doors Tfs 1.2

abdala ragab

Veteran OT User
Joined
Aug 18, 2018
Messages
461
Solutions
11
Reaction score
340
Location
gamelaot.sytes.net
I have a problem with the doors
I want it if you close the door and get out of the magic wall if it's in front of the door

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemId = item:getId()
    if isInArray(questDoors, itemId) then
        if player:getStorageValue(item.actionid) ~= -1 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
        return true
    elseif isInArray(levelDoors, itemId) then
        if item.actionid > 0 and player:getLevel() >= item.actionid - 1000 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
        end
        return true
    elseif isInArray(keys, itemId) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.itemid] then
                target:transform(doors[target.itemid])
                return true
            end
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            return true
        end
        return false
    end

    if isInArray(horizontalOpenDoors, itemId) or isInArray(verticalOpenDoors, itemId) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature ~= nil then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, query)
                return true
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not isInArray(openSpecialDoors, itemId) then
            item:transform(itemId - 1)
        end
        return true
    end

    if doors[itemId] then
        if item.actionid == 0 then
            item:transform(doors[itemId])
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
        return true
    end
    return false
end
 
Solution
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey) --agregado doors 7.4
    local itemId = item:getId()
    if table.contains(questDoors, itemId) then
        if player:getStorageValue(item.actionid) ~= -1 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
        return true
    elseif table.contains(levelDoors, itemId) then
        if item.actionid > 0 and player:getLevel() >= item.actionid - 1000 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else...
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey) --agregado doors 7.4
    local itemId = item:getId()
    if table.contains(questDoors, itemId) then
        if player:getStorageValue(item.actionid) ~= -1 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
        return true
    elseif table.contains(levelDoors, itemId) then
        if item.actionid > 0 and player:getLevel() >= item.actionid - 1000 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
        end
        return true
    elseif table.contains(keys, itemId) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.itemid] then
                target:transform(doors[target.itemid])
                return true
            end
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            return true
        end
        return false
    end

        if table.contains(verticalOpenDoors, itemId) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, itemId) then
            item:transform(itemId - 1)
        end
        return true
    end
 
[B][SIZE=6]problem solved 100%[/SIZE][/B]

            if table.contains(horizontalOpenDoors, itemId) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.y = toPosition.y + 1
            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, itemId) then
            item:transform(itemId - 1)
        end
        return true
    end

    if doors[itemId] then
        if item.actionid == 0 then
            item:transform(doors[itemId])
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
        return true
    end
    return false
end
problem solved 100%
 
Solution
Back
Top