bpm91
Advanced OT User
- Joined
- May 23, 2019
- Messages
- 1,046
- Solutions
- 7
- Reaction score
- 180
- Location
- Brazil
- YouTube
- caruniawikibr
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 !=...
Next time is an official warning.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.
When I provided the rules, you didn't provide the server version you were using at that time. Now I see you edited it.@Delusion
I told all the possible information. There are no errors in the distro. my ot server already came with this
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
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
Maybe heHow about the Depot ID you have city listed there as Carlin?
setHouseOwner() function don't give back itens from house to last owner depot, i don't have 0.4 sources to checkfunction 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
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;
}
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;
}