Well, its like if i'm 20 lvls different from ya, you can't attack me, it used to exist, since i have a pvp-e i needed it so i make this one, here it goes:
in configmanager.cpp, below:
add:
in configmanager.h, below:
add:
in combat.cpp, below:
add:
c++ part done :thumbup:
now in config.lua anywhere just add:
0 = deactiaved, and the number you put there will be the difference of lvls to the protection get activated.
Like, if u put 30, a lvl 100 can't attack a lvl 70 ^^
cya, i made it in my TFS 0.3b3 sources...
in configmanager.cpp, below:
Code:
m_confNumber[MAX_PLAYER_SUMMONS] = getGlobalNumber(L, "maxPlayerSummons", 2);
add:
Code:
m_confNumber[PROTECT_LEVEL] = getGlobalNumber(L, "leveldiffallowattack", 0);
in configmanager.h, below:
Code:
MAX_PLAYER_SUMMONS,
add:
Code:
PROTECT_LEVEL,
in combat.cpp, below:
Code:
checkZones = true;
if((g_game.getWorldType() == WORLD_TYPE_NO_PVP && !Combat::isInPvpZone(attacker, target)) ||
isProtected(const_cast<Player*>(attackerPlayer), const_cast<Player*>(targetPlayer)))
return RET_YOUMAYNOTATTACKTHISPLAYER;
add:
Code:
//level dif protection by ravock.
uint32_t plvl = g_config.getNumber(ConfigManager::PROTECT_LEVEL);
if(plvl != 0)
{
if((attackerPlayer->getLevel()) > ((targetPlayer->getLevel()) + (plvl)) || (attackerPlayer->getLevel()) < ((targetPlayer->getLevel()) - (plvl)))
return RET_YOUMAYNOTATTACKTHISPLAYER;
}
c++ part done :thumbup:
now in config.lua anywhere just add:
Code:
leveldiffallowattack = 0
0 = deactiaved, and the number you put there will be the difference of lvls to the protection get activated.
Like, if u put 30, a lvl 100 can't attack a lvl 70 ^^
cya, i made it in my TFS 0.3b3 sources...
Last edited: