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

[TFS 1.0] Walkthrough Low Level Players depoit

Sakurasoft

New Member
Joined
May 19, 2014
Messages
10
Reaction score
0
Hey guys,

I wanted to make it so that low level players can't be used to block traps and spawns so I made it so that they can be walkedthrough even outside of the pz. To prevent players from walking on them on Depot tiles I had to make depot tiles Non-PvP zone and return false for non-pvp zones. The problem I'm having right now is that, normally players aren't able to walk through low level players on depot tiles. However, players who are using Dash on Magebot are able to dash through players below protection level even on depot tiles!

This is my player.cpp, is there any way to prevent that?

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

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

if ((player->isAttackable() &&
(player->getLevel() < (uint32_t)g_config.getNumber(ConfigManager::pROTECTION_LEVEL))))
return true;

const Tile* playerTile = player->getTile();
if (playerTile && playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
Item* playerTileGround = playerTile->ground;
if (playerTileGround && playerTileGround->hasWalkStack()) {
Player* thisPlayer = const_cast<Player*>(this);
if ((OTSYS_TIME() - lastWalkthroughAttempt) > 2000) {
thisPlayer->setLastWalkthroughAttempt(OTSYS_TIME());
return true;
}

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

thisPlayer->setLastWalkthroughPosition(creature->getPosition());
return true;
}
}

return false;
}

bool Player::canWalkthroughEx(const Creature* creature) const
{
if (group->access) {
return true;
}

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

const Tile* playerTile = player->getTile();
if ((!player->isAttackable() &&
(player->getLevel() > (uint32_t)g_config.getNumber(ConfigManager::pROTECTION_LEVEL))))
return true;
return playerTile && playerTile->hasFlag(TILESTATE_NONE);
}
 
Back
Top