• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

trash in houses

bpm91

Advanced OT User
Joined
May 23, 2019
Messages
1,046
Solutions
7
Reaction score
180
Location
Brazil
YouTube
caruniawikibr
I recently tried to implement this on my server but it didn't work.


I don't know what it could be, as I recently implemented the moveitem option, even managed to parchment the global tibia quest with the moveitem function.

Screenshot_1.png
LUA:
registerCreatureEvent(cid, "houseTrash")

LUA:
<event type="moveitem" name="houseTrash" event="script" value="houseTrash.lua"/>

LUA:
function onMoveItem(moveItem, frompos, position, cid)
    if position.x == CONTAINER_POSITION then
        return true
    end

    local house = getHouseFromPos(position)
    if type(house) == 'number' then
        local owner = getHouseOwner(house)   
        if owner == 0 then
            return false, doPlayerSendCancel(cid, 'Sorry, not possible.')
        end
  
        if owner ~= getPlayerGUID(cid) then
            local sub = getHouseAccessList(house, 0x101):explode('\n')
            local guest = getHouseAccessList(house, 0x100):explode('\n')
            local isInvited = false

            if (#sub > 0) and isInArray(sub, getCreatureName(cid)) then
                isInvited = true
            end
          
            if (#guest > 0) and isInArray(guest, getCreatureName(cid)) then
                isInvited = true
            end           
      
            if not isInvited then
                return false, doPlayerSendCancel(cid, 'Sorry its not possible bcus you are not invited.')
            end
        end
    end
    return true
end
 
Solution
To make this work you'll have to add this function to your source files
Or you can just add house trash prevention through source files by editing housetile.cppExactly like this
Just change return RET_TILEISFULL; to RET_NOTPOSSIBLE; and it will work properly.
Yes i do in my source
 
Yes i do in my source
The function expect for cid, item, count, toContainer, fromContainer, fromPos, toPos as parameters, and u are passing
moveItem, frompos, position, cid
 
To make this work you'll have to add this function to your source files
Or you can just add house trash prevention through source files by editing housetile.cppExactly like this
Just change return RET_TILEISFULL; to RET_NOTPOSSIBLE; and it will work properly.
 
Last edited:
Solution
Yeah this should work but I think your source has already some kind of trash prevention or house protection can you check your configmanager.cpp and search for
HOUSEPROTECTION or HOUSE_PROTECTION or anything related to this?
 
Back
Top