- Joined
- Jan 15, 2014
- Messages
- 1,317
- Solutions
- 35
- Reaction score
- 434
Hello community,
How can I change this code so that players can gain experience from killing all higher level players without a level range.
So I want to change this to the level player who is being killed.
g_config.getNumber(ConfigManager::EXP_FROM_PLAYERS_LEVEL_RANGE)
This is what it is normally:
This is my attempt to change it:
But i'm getting this error:
How can I change this code so that players can gain experience from killing all higher level players without a level range.
So I want to change this to the level player who is being killed.
g_config.getNumber(ConfigManager::EXP_FROM_PLAYERS_LEVEL_RANGE)
This is what it is normally:
Code:
uint64_t Player::getGainedExperience(Creature* attacker) const
{
if (g_config.getBoolean(ConfigManager::EXPERIENCE_FROM_PLAYERS)) {
Player* attackerPlayer = attacker->getPlayer();
if (attackerPlayer && attackerPlayer != this && skillLoss && std::abs((int32_t)(attackerPlayer->getLevel() - level)) <= g_config.getNumber(ConfigManager::EXP_FROM_PLAYERS_LEVEL_RANGE)) {
return std::max<uint64_t>(0, std::floor(getLostExperience() * getDamageRatio(attacker) * 0.75));
}
}
return 0;
}
This is my attempt to change it:
Code:
uint64_t Player::getGainedExperience(Creature* attacker) const
{
if (g_config.getBoolean(ConfigManager::EXPERIENCE_FROM_PLAYERS)) {
Player* attackerPlayer = attacker->getPlayer();
if (attackerPlayer && attackerPlayer != this && skillLoss && std::abs((int32_t)(attackerPlayer->getLevel() - 0)) <= level) {
return std::max<uint64_t>(0, std::floor(getLostExperience() * getDamageRatio(attacker) * 0.020));
}
}
return 0;
}
But i'm getting this error:
Code:
1>..\src\player.cpp(3354): warning C4018: '<=' : signed/unsigned mismatch
Last edited: