I cant get config.lua work with exp for killing players, so I made a script, though its not working (makes players lvl 1 when killing).
Can anyone get right formula ?
Can anyone get right formula ?
LUA:
function roundNum(val, decimal)
if (decimal) then
return math.floor(((val * 10^decimal) + 0.5) / (10^decimal))
else
return math.floor(val+0.5)
end
end
function onKill(cid, target)
if(isPlayer(target)) then
if(getPlayerLevel(cid) < getPlayerLevel(target)) then
doPlayerAddExperience(cid, roundNum((getExperienceForLevel(getPlayerLevel(cid)*(getPlayerLevel(target)/10)) - getPlayerExperience(cid)), 0))
end
end
return true
end