beenii
Well-Known Member
- Joined
- Jul 26, 2010
- Messages
- 584
- Solutions
- 1
- Reaction score
- 57
Hello I have a few hours trying to make that work in nopvp zone
in here in function
I can't get players walk through on nopvp zone
my functions on players.cpp
in here in function
C++:
bool Player::canWalkthrough(const Creature* creature) const
I can't get players walk through on nopvp zone
my functions on players.cpp
Code:
bool Player::canWalkthrough(const Creature* creature) const
{
if (group->access || creature->isInGhostMode()) {
return true;
}
const Player* player = creature->getPlayer();
if (!player || !g_config.getBoolean(ConfigManager::ALLOW_WALKTHROUGH)) {
return false;
}
const Tile* playerTile = player->getTile();
if (!playerTile || (!playerTile->hasFlag(TILESTATE_PROTECTIONZONE) && player->getLevel() > static_cast<uint32_t>(g_config.getNumber(ConfigManager::PROTECTION_LEVEL)))) {
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;
}
bool Player::canWalkthroughEx(const Creature* creature) const
{
if (group->access) {
return true;
}
const Player* player = creature->getPlayer();
if (!player || !g_config.getBoolean(ConfigManager::ALLOW_WALKTHROUGH)) {
return false;
}
const Tile* playerTile = player->getTile();
return playerTile && (playerTile->hasFlag(TILESTATE_PROTECTIONZONE) || player->getLevel() <= static_cast<uint32_t>(g_config.getNumber(ConfigManager::PROTECTION_LEVEL)));
}