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

C++ TFS 1.2 Disable walking trough players in protected zone

henkas

Active Member
Joined
Jul 8, 2015
Messages
888
Solutions
4
Reaction score
43
How to disable players walking trough each other in protected zone TFS 1.2

C++:
bool Player::canWalkthrough(const Creature* creature) const
{
    if (group->access || creature->isInGhostMode()) {
        return true;
    }

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

    const Tile* playerTile = player->getTile();
    if (!playerTile || !playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
        return false;
    }

    const Item* playerTileGround = playerTile->getGround();
    if (!playerTileGround || !playerTileGround->hasWalkStack()) {
        return false;
    }

    Player* thisPlayer = const_cast<Player*>(this);
    if ((OTSYS_TIME() - lastWalkthroughAttempt) > 2000) {
        thisPlayer->setLastWalkthroughAttempt(OTSYS_TIME());
        return false;
    }

    if (creature->getPosition() != lastWalkthroughPosition) {
        thisPlayer->setLastWalkthroughPosition(creature->getPosition());
        return false;
    }

    thisPlayer->setLastWalkthroughPosition(creature->getPosition());
    return true;
}
Tried commenting these lines
C++:
    if (!playerTile || !playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
        return false;
    }
didnt worked
 

sharinn

Member
Joined
Aug 27, 2011
Messages
89
Solutions
4
Reaction score
17
C++:
const Tile* playerTile = player->getTile();
    if (!playerTile || !playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
        return false;
    }

try chabge to
C++:
const Tile* playerTile = player->getTile();
    if (playerTile && playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
        return false;
    }

written on phone, can not work at all :/
 
Top