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

Depot Tiles Error [TFS 1.3]

SUMEKAZEKI

ADM Custom Rook
Joined
Sep 10, 2016
Messages
39
Reaction score
4
i add tiles on the spot depot and if i stepin got error like this:
HmLY3uT.png

tiles.lua
LUA:
local increasing = {[416] = 417, [426] = 425, [446] = 447, [3216] = 3217, [3202] = 3215, [11062] = 11063}
local decreasing = {[417] = 416, [425] = 426, [447] = 446, [3217] = 3216, [3215] = 3202, [11063] = 11062}

function onStepIn(creature, item, position, fromPosition)
    if not increasing[item.itemid] then
        return true
    end

    if not creature:isPlayer() or creature:isInGhostMode() then
        return true
    end

    item:transform(increasing[item.itemid])

    if item.actionid >= 1000 then
        if creature:getLevel() < item.actionid - 1000 then
            creature:teleportTo(fromPosition, false)
            position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            creature:sendTextMessage(MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
        end
        return true
    end

    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        local lookPosition = creature:getPosition()
        lookPosition:getNextPosition(creature:getDirection())
            local depotItems = 0
            for i = 1, 17 do
                depotItems = depotItems + player:getDepotChest(i, true):getItemHoldingCount()
            end

        if depotItem then
            local depotItems = creature:getDepotChest(getDepotId(depotItem:getUniqueId()), true):getItemHoldingCount()
            creature:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Your depot contains " .. depotItems .. " item" .. (depotItems > 1 and "s." or "."))
            return true
        end
    end

    if item.actionid ~= 0 and creature:getStorageValue(item.actionid) <= 0 then
        creature:teleportTo(fromPosition, false)
        position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
        return true
    end
    return true
end

function onStepOut(creature, item, position, fromPosition)
    if not decreasing[item.itemid] then
        return true
    end

    if creature:isPlayer() and creature:isInGhostMode() then
        return true
    end

    item:transform(decreasing[item.itemid])
    return true
end
 
Solution
A
LUA:
local increasing = {[416] = 417, [426] = 425, [446] = 447, [3216] = 3217, [3202] = 3215, [11062] = 11063}
local decreasing = {[417] = 416, [425] = 426, [447] = 446, [3217] = 3216, [3215] = 3202, [11063] = 11062}

function onStepIn(creature, item, position, fromPosition)
    if not increasing[item.itemid] then
        return true
    end

    if not creature:isPlayer() or creature:isInGhostMode() then
        return true
    end

    item:transform(increasing[item.itemid])

    if item.actionid >= 1000 then
        if creature:getLevel() < item.actionid - 1000 then
            creature:teleportTo(fromPosition, false)
            position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            creature:sendTextMessage(MESSAGE_INFO_DESCR, "The tile seems to be protected...
LUA:
local increasing = {[416] = 417, [426] = 425, [446] = 447, [3216] = 3217, [3202] = 3215, [11062] = 11063}
local decreasing = {[417] = 416, [425] = 426, [447] = 446, [3217] = 3216, [3215] = 3202, [11063] = 11062}

function onStepIn(creature, item, position, fromPosition)
    if not increasing[item.itemid] then
        return true
    end

    if not creature:isPlayer() or creature:isInGhostMode() then
        return true
    end

    item:transform(increasing[item.itemid])

    if item.actionid >= 1000 then
        if creature:getLevel() < item.actionid - 1000 then
            creature:teleportTo(fromPosition, false)
            position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            creature:sendTextMessage(MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
        end
        return true
    end

    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        local lookPosition = creature:getPosition()
        lookPosition:getNextPosition(creature:getDirection())
            local depotItems = 0
            for i = 1, 17 do
                depotItems = depotItems + creature:getDepotChest(i, true):getItemHoldingCount()
            end

        if depotItem then
            local depotItems = creature:getDepotChest(getDepotId(depotItem:getUniqueId()), true):getItemHoldingCount()
            creature:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Your depot contains " .. depotItems .. " item" .. (depotItems > 1 and "s." or "."))
            return true
        end
    end

    if item.actionid ~= 0 and creature:getStorageValue(item.actionid) <= 0 then
        creature:teleportTo(fromPosition, false)
        position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
        return true
    end
    return true
end

function onStepOut(creature, item, position, fromPosition)
    if not decreasing[item.itemid] then
        return true
    end

    if creature:isPlayer() and creature:isInGhostMode() then
        return true
    end

    item:transform(decreasing[item.itemid])
    return true
end
 
Solution
Back
Top