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

Feature Creatureevent OnGainExp

my gain experience its not the same
Code:
bool Player::gainExperience(double& gainExp, bool fromMonster)

i change all function to that
Code:
bool Player::gainExperience(double& gainExp, bool fromMonster)
{
     if(!rateExperience(gainExp, fromMonster))
   		return false;
          bool deny = false;
		CreatureEventList gainExpEvents = this->getCreatureEvents(CREATURE_EVENT_GAINEXP);
		for(CreatureEventList::iterator it = gainExpEvents.begin(); it != gainExpEvents.end(); ++it)
		{
			if(!(*it)->executeGainExp(this, gainExp))
				deny = true;
		}
		if(deny)
        return false; 
     
     addExperience((uint64_t)gainExp);
     return true;
}

and i have this error
Code:
 C:\Users\Bruna\Documents\fox\soucers - Cópia\player.cpp In member function `bool Player::gainExperience(double&, bool)': 
3665 C:\Users\Bruna\Documents\fox\soucers - Cópia\player.cpp [Warning] passing `double' for converting 2 of `uint32_t CreatureEvent::executeGainExp(Player*, int32_t)'

ps:I removed the condition of the soul, because I need this does not work on my server


@Edit-
i try remove the "this->" but is the same shit

@Edit-2
i try change to that
and i not have compilation error
Code:
bool Player::gainExperience(double& gainExp, bool fromMonster)
{
     if(!rateExperience(gainExp, fromMonster))
   		return false;
     //if(gainExp >= 1)
    // {
        bool deny = false;
		CreatureEventList gainExpEvents = getCreatureEvents(CREATURE_EVENT_GAINEXP);
		for(CreatureEventList::iterator it = gainExpEvents.begin(); it != gainExpEvents.end(); ++it)
		{
			if(!(*it)->executeGainExp(this,gainExp))
				deny = true;
		}
		if(deny)
                return false;
        
        addExperience((uint64_t)gainExp);
        return true;
    // }
}

Edit-3
When i try to compile with Ctrl-f11 give me the same error!
 
Last edited:
Back
Top