To save XP is simple, by just using MySQL to store data in tables.
To actually accrue XP from combat and have levelling is something entirely different. You need to make an algorithm... all the good algorithms are based on logarithmic functions.
For example, here is the Runescape XP function to tell how much XP you need for a level:
Code:
experience(level)
{
new x, Float:ret
for (x=1; x<level; x++)
{
ret += (x + 300*pow(float(2), float(x/7)))
}
return floatround(ret/4)
}
reference
As for player versus player experience, it becomes more complicated as you need to take into account the other player's level.
A long time ago in a galaxy far away, I was fooling around with this and tried to write a stats plugin... I don't remember if it worked, or what the formula is, but the source is here:
Click here for bail_stats.sma. Look for "root_xp" which takes level of killer and level of victim and returns how much XP the killer earns.
The SIMPLEST solution... is to just do cumulative XP and fool around with little numbers... but I'd rather not think about it
__________________