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

Not tradeable, not moveable to depot, not moveable to floor

Block move:
Code:
local items = {12670, 12661}
function searchContainers(uid,itemss)
    local items = itemss
    local containers = {}
    local check = false
    for i = 0, getContainerSize(uid)-1 do
        local item = getContainerItem(uid,i)
        if not isContainer(item.uid) then
            if isInArray(items,item.itemid) then
                check = true
            end
        else
            table.insert(containers,item.uid)
        end
    end
    for _, container in ipairs(containers) do
        if searchContainers(container,items) then
            check = true
            break
        end
    end
    return check
end   
function onMoveItem(cid, item, formPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
    if status.inInv == 1 and status.inInvBag == 3 and status.inDepot == 3 and isInArray(items,getPlayerSlotItem(cid,status.slot).itemid ) then
        doPlayerSendCancel(cid,"You can't drop a special item on the ground.")
        doSendMagicEffect(getThingPos(cid),2)
        return false
    end
    if (status.inInv == 0 and status.inInvBag == 3 and status.inDepot == 3) or
        (status.inDepot == 0 and status.inInv == 3 and status.inInvBag == 3 ) or
        (status.inInvBag == 0 and status.inDepot == 3 and status.inInv == 3) then
        if not isContainer(item.uid) then
            if isInArray(items,item.itemid) then
                doPlayerSendCancel(cid,"You can't drop a special item on the ground.")
                doSendMagicEffect(getThingPos(cid),2)
                return false
            end
        else
            if searchContainers(item.uid,items) then
                doPlayerSendCancel(cid,"You can't throw this bag that contains special item[s] on ground")
                doSendMagicEffect(getThingPos(cid),2)
                return false
            end
        end
    end
    return true
end

Block trade:
Code:
local itemsnoTrade = {12670, 12661}

function onTradeRequest(cid, target, item, targetItem)

if not isContainer(item.uid) then
    if (isInArray(itemsnoTrade, item.itemid)) then
        doPlayerSendCancel (cid, "You can't trade this item.")
        doSendMagicEffect(getThingPos(cid),2)
    return false
    end
else
if searchContainers(item.uid,itemsnoTrade) then
    doPlayerSendCancel(cid,"You can't trade this bag that contains special item[s].")
    doSendMagicEffect(getThingPos(cid),2)
    return false
    end
end       
       
return true
end
 
Back
Top