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

Lua [onKill] When kill player gain xp? [rep++]

picachu

Member
Joined
Dec 2, 2007
Messages
970
Reaction score
11
Hi guys!
I want when you kill a player, you gain exp according to stages? But only gain exp if you're lvl 200+! I can't use rateExperienceFromPlayers because it will give exp in any lvl. I wanna only lvl 200+ will receive exp.
Thanks!
 
Code:
double Player::getGainedExperience(Creature* attacker) const
{
	if(!skillLoss)
		return 0;

	Player* attackerPlayer = attacker->getPlayer();
	if(!attackerPlayer || attackerPlayer == this)
		return 0;

	double attackerLevel = (double)attackerPlayer->getLevel(), min = g_config.getDouble(
		ConfigManager::EFP_MIN_THRESHOLD), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
	if([B][COLOR="red"]attackerLevel < 200 || [/COLOR][/B](min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 && level > (uint32_t)std::floor(attackerLevel * max)))
		return 0;
		
	double rate = [B][COLOR="red"]attackerPlayer->[/COLOR][/B]rates[SKILL__LEVEL] * g_game.getExperienceStage([B][COLOR="red"]attackerL[/COLOR][/B]evel, [B][COLOR="red"]attackerPlayer->getV[/COLOR][/B]ocation()->getExperienceMultiplier());
	if(rate <= 0)
		return 0;
 
Code:
double Player::getGainedExperience(Creature* attacker) const
{
	if(!skillLoss)
		return 0;

	Player* attackerPlayer = attacker->getPlayer();
	if(!attackerPlayer || attackerPlayer == this)
		return 0;

	double attackerLevel = (double)attackerPlayer->getLevel(), min = g_config.getDouble(
		ConfigManager::EFP_MIN_THRESHOLD), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
	if([B][COLOR="red"]attackerLevel < 200 || [/COLOR][/B](min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 && level > (uint32_t)std::floor(attackerLevel * max)))
		return 0;
		
	double rate = [B][COLOR="red"]attackerPlayer->[/COLOR][/B]rates[SKILL__LEVEL] * g_game.getExperienceStage([B][COLOR="red"]attackerL[/COLOR][/B]evel, [B][COLOR="red"]attackerPlayer->getV[/COLOR][/B]ocation()->getExperienceMultiplier());
	if(rate <= 0)
		return 0;

didn't work :<
 
"I wanna only lvl 200+ will receive exp."

I think he ment that he would like a stage at level 200+ so player wouldn't lvl up by killing each other as fast as before.
I got the same problem in my War server. I would appreciate if someone could give me some help about stage killing.
Thank you. Have a Good game.
 
Back
Top