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

Lua Depot contains

KucakMarcin

New Member
Joined
Apr 23, 2013
Messages
13
Reaction score
0
Hello guys, i dont have information about "Your depot contains ", i have the forgetten server edit by Cyko V8(8.6)

tiles.lua

Code:
local increasingItemID = {416, 446, 3216, 11062}
local decreasingItemID = {417, 447, 3217, 11063}

function onStepIn(cid, item, position, fromPosition)
    if isInArray(increasingItemID, item.itemid) then
        doTransformItem(item.uid, item.itemid + 1)
        if item.actionid > 1000 then
            getLevelTile(cid, item, position)
        elseif getTilePzInfo(position) then
            getDepotItems(cid, position)
        end
    elseif item.itemid == 426 then
        doTransformItem(item.uid, 425)
        if item.actionid > 1000 then
            getLevelTile(cid, item, position)
        elseif getTilePzInfo(position) then
            getDepotItems(cid, position)
        end
    end
    return true
end

function onStepOut(cid, item, position, fromPosition)
    if isInArray(decreasingItemID, item.itemid) then
        doTransformItem(item.uid, item.itemid - 1)
    elseif item.itemid == 425 then
        doTransformItem(item.uid, item.itemid + 1)
    end
    return true
end

function getLevelTile(cid, item, position)
    local player = Player(cid)
    if player == nil then
        return
    end

    if player:getLevel() < item.actionid - 1000 then
        local playerPosition = player:getPosition()
        doTeleportThing(cid, {x = playerPosition.x, y = playerPosition.y, z = playerPosition.z + 1})
        playerPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    end
end

function getDepotItems(cid, position)
    local player = Player(cid)
    if player == nil then
        return
    end
    if position:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then
        local lookPos = player:getPosition()
        lookPos:getNextPosition(player:getDirection())
        local depotItem = lookPos:getTile():getItemByType(ITEM_TYPE_DEPOT)
        if depotItem ~= nil then
            local depotItems = player:getDepotChest(getDepotId(depotItem:getUniqueId()), true):getItemHoldingCount()
            local depotMails = player:getInbox():getItemHoldingCount()
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, ("Your depot contains %s item%s, and %s news%s."):format(depotItems, (depotItems > 1 and "s" or ""), depotMails, (depotMails > 1 and " or parcels" or "")))
            return true
        end
    end
end

sorry for my bad english :]
 
Back
Top