• 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 Experience from Player

lorduke

New Member
Joined
May 22, 2009
Messages
32
Reaction score
1
Hello,

I want know why this don't work.
I wanna if player is lv 200 kill a player lv 50 gain experience,I'm put to 0 but this don't work too.

Code:
	minLevelThresholdForKilledPlayer = 0.1
	maxLevelThresholdForKilledPlayer = 9.0

Regards,
Lorduke.
 
-- Experience from players
-- NOTE: min~Threshold* set to 0 will disable the minimum threshold:
-- player will gain experience from every lower leveled player.
-- max~Threshold* set to 0 will disable the maximum threshold:
-- player will gain experience from every higher leveled player.

minLevelThresholdForKilledPlayer = 0
maxLevelThresholdForKilledPlayer = 0
 
Why do you wanna have high levels pking lowbies? :S

This will give you (configured)% of exp when you kill another player, no matter what level he is.
Lua:
 -- Quickly written by Znote.
function onKill(cid, target, lastHit)
	local percent = 5 -- you get 5% experience from enemys total exp

	if isPlayer(target) then -- If you killed a player and not a monster:
		local xp = getPlayerExperience(target) -- fetch enemy experience
		local calc = ((xp/100) * percent) -- calculate 1% of enemy experience, and multiply it with configured "percent"
		local gain = math.floor(calc) -- Make sure the value is integer (etc 230 instead of 230,123123123)
		
		doPlayerAddExperience(cid, gain) -- gives you the calculated experience
	end
	return true
end

Edit: Script contains basic functionality. Should be easy to extend further to your liking.
Remember to put the exprate to a lower percent than what the player loses when he dies. (Also you should consider his loss with blessings).
 
Last edited:
Back
Top