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

exp per hit

it's not working, i can't log character in server :S
and the script would be something like that :

health = 1000 gives 1000 of experience
player hit 200 on the monster and recives 200 of exp
 
Last edited:
try this script:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(cid) then
		if getPlayerIp(cid) ~= getPlayerIp(attacker) then
                    if type == STATSCHANGE_HEALTHLOSS then
		local x,r = getPlayerLevel(attacker),math.random(10,35)
		local m = 3.5*x+r -- formula .. m = 3.5*getPlayerLevel(attacker)*math.random(10,35)
			doPlayerAddExperience(cid,m)
			doPlayerSendTextMessage(cid,27,'Gained '..m..' experience.')
                     end
		else
			doPlayerSendTextMessage(cid,27,'Can\'t gain experience from attacking players with same IP.')
			return false
		end
	else
		return false
	end
	return true
end

Test. :)
 
You shouldnt use return false, and statschange return the value according to the type according to the cid so healthloss this will return the attack value cid go so you cant use it here
 
Last edited:
This is just a big fail thread.
Use the function I posted earlier...

New functions, always fun. :p
 
Can you explain what you want exactly?

Every time you attack, you get XX exp? I don't understand.
 
it's like this :
if monster has 100 of life and gives 100 experience , if you hit 10 wou will receive 10 exp.
it's proportional
 
Lua:
function onStatsChange(cid, attacker, type, combat, value)
 
	if isPlayer(attacker) and isPlayer(cid) then
		if getPlayerIp(cid) ~= getPlayerIp(attacker) then
			if type == STATSCHANGE_HEALTHLOSS then
				doPlayerAddExperience(attacker, value)
				doPlayerSendTextMessage(attacker, MESSAGE_STATUS_DEFAULT, "You gained " .. value .. " experience points.")
			end
		end
	end
	return true
end
 
Back
Top