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

Solved Going through players in depot problem

bury

Active Member
Joined
Jul 27, 2008
Messages
421
Solutions
7
Reaction score
25
Hello, I have a problem in depot with this function. It works fine but you can get other creature position in front of locker so you can steal his items lol:

problema1.jpg
ç

problema2.jpg


player.cpp

C++:
bool Player::canWalkthrough(const Creature* creature) const
{
    if(creature == this || hasCustomFlag(PlayerCustomFlag_CanWalkthrough) || creature->isWalkable() ||
        (creature->getMaster() && creature->getMaster() != this && canWalkthrough(creature->getMaster())))
        return true;

    const Player* player = creature->getPlayer();
    if(!player)
        return false;

    if((((g_game.getWorldType() == WORLDTYPE_OPTIONAL && !player->isEnemy(this, true) &&
        player->getVocation()->isAttackable()) || player->getTile()->hasFlag(TILESTATE_PROTECTIONZONE) || (player->getVocation()->isAttackable() &&
        player->getLevel() < (uint32_t)g_config.getNumber(ConfigManager::PROTECTION_LEVEL))) && player->getTile()->ground &&
        Item::items[player->getTile()->ground->getID()].walkStack) && (!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)
        || player->getAccess() <= getAccess()))
        return true;

    return (player->isGhost() && getGhostAccess() < player->getGhostAccess())
        || (isGhost() && getGhostAccess() > player->getGhostAccess());
}

I'm using /3777-master/ sources.

TFS 0.4

I'm using debian 9
 
Solution
Hello, I have a problem in depot with this function. It works fine but you can get other creature position in front of locker so you can steal his items lol:

problema1.jpg
ç

problema2.jpg


player.cpp

C++:
bool Player::canWalkthrough(const Creature* creature) const
{
    if(creature == this || hasCustomFlag(PlayerCustomFlag_CanWalkthrough) || creature->isWalkable() ||
        (creature->getMaster() && creature->getMaster() != this && canWalkthrough(creature->getMaster())))
        return true;

    const Player* player = creature->getPlayer();
    if(!player)
        return false;

    if((((g_game.getWorldType() == WORLDTYPE_OPTIONAL && !player->isEnemy(this...
Hello, I have a problem in depot with this function. It works fine but you can get other creature position in front of locker so you can steal his items lol:

problema1.jpg
ç

problema2.jpg


player.cpp

C++:
bool Player::canWalkthrough(const Creature* creature) const
{
    if(creature == this || hasCustomFlag(PlayerCustomFlag_CanWalkthrough) || creature->isWalkable() ||
        (creature->getMaster() && creature->getMaster() != this && canWalkthrough(creature->getMaster())))
        return true;

    const Player* player = creature->getPlayer();
    if(!player)
        return false;

    if((((g_game.getWorldType() == WORLDTYPE_OPTIONAL && !player->isEnemy(this, true) &&
        player->getVocation()->isAttackable()) || player->getTile()->hasFlag(TILESTATE_PROTECTIONZONE) || (player->getVocation()->isAttackable() &&
        player->getLevel() < (uint32_t)g_config.getNumber(ConfigManager::PROTECTION_LEVEL))) && player->getTile()->ground &&
        Item::items[player->getTile()->ground->getID()].walkStack) && (!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)
        || player->getAccess() <= getAccess()))
        return true;

    return (player->isGhost() && getGhostAccess() < player->getGhostAccess())
        || (isGhost() && getGhostAccess() > player->getGhostAccess());
}

I'm using /3777-master/ sources.

TFS 0.4

I'm using debian 9
You'll have 1 more issue when players are PZ too, Can't explain a lot but it will look like entering PZ while you are PZ you'll go through players then it will return back like you are entering PZ zone.
Anyways to solve this problem replace the above code with this.
C++:
bool Player::canWalkthrough(const Creature* creature) const
{
    if(hasCustomFlag(PlayerCustomFlag_CanWalkthrough))
        return true;

    if(!creature)
        return true;

    if(creature == this)
        return false;

    const Player* player = creature->getPlayer();
    if(!player)
        return false;

    return player->isGhost() && getGhostAccess() < player->getGhostAccess();
}
 
Solution
Thanks @Mustafa1337 ,now they dont go through the others in any moment, isnt it? Even if player is lower leven than protection level?

It worked and compiled without problems! If this is the newest pack of src for 0.4 even for the last linux rev to compile, I dont know how this error could be there yet.
 
Thanks @Mustafa1337 ,now they dont go through the others in any moment, isnt it? Even if player is lower leven than protection level?

It worked and compiled without problems! If this is the newest pack of src for 0.4 even for the last linux rev to compile, I dont know how this error could be there yet.
Yeah now they won't go through each other at all, That is safer because there are other errors could be caused in the future.
 
Back
Top