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

House - Lose item

bpm91

Advanced OT User
Joined
May 23, 2019
Messages
1,046
Solutions
7
Reaction score
180
Location
Brazil
YouTube
caruniawikibr
I buy the house, and put the item in, when I sell the items and I lose them. Does anyone have any idea how to solve? I wanted the items to be deposited in the city where the house is
I would also like to know how I know the rent format is working monthly
TFS 0.4

Screenshot_2.png
Screenshot_3.png
Screenshot_4.png
 
Solution
i found problem.
in house.cpp

change

LUA:
bool House::transferToDepot()

{

if(!townId)

return false;


Player* player = NULL;

if(owner)

{

uint32_t tmp = owner;

if(isGuild() && !IOGuild::getInstance()->swapGuildIdToOwner(tmp))

tmp = 0;



if(tmp)

player = g_game.getPlayerByGuidEx(tmp);

}


Item* item = NULL;

Container* tmpContainer = NULL;


ItemList moveList;

for(HouseTileList::iterator it = houseTiles.begin(); it != houseTiles.end(); ++it)

{

for(uint32_t i = 0; i < (*it)->getThingCount(); ++i)

{

if(!(item = (*it)->__getThing(i)->getItem()))

continue;


if(item->isPickupable())

moveList.push_back(item);

else if((tmpContainer = item->getContainer()))

{

for(ItemList::const_iterator it = tmpContainer->getItems(); it !=...
5. Incomplete Problem Description:
- Post as much useful information as possible. If the problem is about something on your server, post the server version and client version. Also always post the errors you get and the scripts with the problems.
Next time is an official warning.
 
So the items inside houses disappear at all? Or just goes to wrong depot (other city)?
 
Talckactions/scripts/leavehouse

LUA:
function onSay(cid, words, param, channel)
    if getTileHouseInfo(getPlayerPosition(cid)) ~= FALSE then
        if getHouseOwner(getTileHouseInfo(getPlayerPosition(cid))) == getPlayerGUID(cid) then
            setHouseOwner(getTileHouseInfo(getPlayerPosition(cid)), 0)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have successfully left your house.")
        else
            doPlayerSendCancel(cid, "You are not the owner of this house.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    else
        doPlayerSendCancel(cid, "You are not inside a house.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end

    return TRUE
end
 
Try this one and how about !sellhouse? Does it have same issue? In your map editor house is added to Carlin or not?
LUA:
function onSay(cid, words, param, channel)
    local house = getHouseFromPos(getCreaturePosition(cid))
    if(not house) then
        doPlayerSendCancel(cid, "You are not inside a house.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        return false
    end

    local owner = getHouseInfo(house).owner
    if(owner ~= getPlayerGUID(cid) and (owner ~= getPlayerGuildId(cid) or getPlayerGuildLevel(cid) ~= GUILDLEVEL_LEADER)) then
        doPlayerSendCancel(cid, "You are not the owner of this house.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        return false
    end

    setHouseOwner(house, 0)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    return false
end
 
LUA:
function onStepIn(cid, item, pos)

local carlin = {x=32360, y=31782, z=7}

    if item.actionid == 30022 then
        doPlayerSetTown(cid,5)
        doTeleportThing(cid,carlin)
        doSendMagicEffect(getCreaturePosition(cid),12)
        doPlayerSendTextMessage(cid,22, "You are now a citizen of Carlin")
        end
    return 1
end

i belive number 5
 
What is this? Open map editor, Click on your Depot BOX and tell me what is your Depot ID
 
i found problem.
in house.cpp

change

LUA:
bool House::transferToDepot()

{

if(!townId)

return false;


Player* player = NULL;

if(owner)

{

uint32_t tmp = owner;

if(isGuild() && !IOGuild::getInstance()->swapGuildIdToOwner(tmp))

tmp = 0;



if(tmp)

player = g_game.getPlayerByGuidEx(tmp);

}


Item* item = NULL;

Container* tmpContainer = NULL;


ItemList moveList;

for(HouseTileList::iterator it = houseTiles.begin(); it != houseTiles.end(); ++it)

{

for(uint32_t i = 0; i < (*it)->getThingCount(); ++i)

{

if(!(item = (*it)->__getThing(i)->getItem()))

continue;


if(item->isPickupable())

moveList.push_back(item);

else if((tmpContainer = item->getContainer()))

{

for(ItemList::const_iterator it = tmpContainer->getItems(); it != tmpContainer->getEnd(); ++it)

moveList.push_back(*it);

}

}

}


if(player)

{

for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)

g_game.internalRemoveItem(NULL, (*it), (*it)->getItemCount(), false, FLAG_NOLIMIT);


if(player->isVirtual())

{

IOLoginData::getInstance()->savePlayer(player);

delete player;

}

}

else

{

for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)

g_game.internalRemoveItem(NULL, (*it), (*it)->getItemCount(), false, FLAG_NOLIMIT);

}

return true;

}


FOR


LUA:
bool House::transferToDepot()

{

if(!townId)

return false;


Player* player = NULL;

if(owner)

{

uint32_t tmp = owner;

if(isGuild() && !IOGuild::getInstance()->swapGuildIdToOwner(tmp))

tmp = 0;


if(tmp)

player = g_game.getPlayerByGuidEx(tmp);

}


Container* tmpContainer = NULL;

TileItemVector* items = NULL;


ItemList moveList;

for(HouseTileList::iterator it = houseTiles.begin(); it != houseTiles.end(); ++it)

{

if(!(items = (*it)->getItemList()))

continue;


for(ItemVector::iterator iit = items->begin(); iit != items->end(); ++iit)

{

if((*iit)->isPickupable())

moveList.push_back(*iit);

else if((tmpContainer = (*iit)->getContainer()))

{

for(ItemList::const_iterator cit = tmpContainer->getItems(); cit != tmpContainer->getEnd(); ++cit)

moveList.push_back(*cit);

}

}

}


if(player)

{

Depot* depot = player->getDepot(townId, true);

for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)

g_game.internalMoveItem(NULL, (*it)->getParent(), depot, INDEX_WHEREEVER, (*it), (*it)->getItemCount(), NULL, FLAG_NOLIMIT);


if(player->isVirtual())

{

IOLoginData::getInstance()->savePlayer(player);

delete player;

}

}

else

{

for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)

g_game.internalRemoveItem(NULL, (*it), (*it)->getItemCount(), false, FLAG_NOLIMIT);

}

return true;

}
 
Solution
Back
Top