Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Experience overflow fix


RaphaelÃâžÂ
 Share

Recommended Posts

Hi! This is my first tutorial (or in this case, fix :P). Do not repair the spelling errors, English was never my forte (I'm using google translator).

I saw an error, which forces the server to close by too much experience a player (basically because there is a limit).
I made a correction, it was quite simple, if you have any errors, please let me know.

On the server, go to modPlayer, and locate "Player(index).exp = exp".
Add this code below:
```
If GetPlayerLevel(index) = MAX_LEVELS And Player(index).exp > GetPlayerNextLevel(index) Then
Player(index).exp = GetPlayerNextLevel(index)
End If
```
On the client, add before the "Sub SetPlayerExp"(modDatabase) the following code:
```
Function GetPlayerNextLevel(ByVal index As Long) As Long
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If index > MAX_PLAYERS Then Exit Function
    GetPlayerNextLevel = (50 / 3) * ((GetPlayerLevel(index) + 1) ^ 3 - (6 * (GetPlayerLevel(index) + 1) ^ 2) + 17 * (GetPlayerLevel(index) + 1) - 12)

    ' Error handler
    Exit Function
errorhandler:
    HandleError "GetPlayerNextLevel", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Function
End Function
```
And below the "Player(index).EXP" (Sub SetPlayerExp), this code:
```
If GetPlayerLevel(index) = MAX_LEVELS And Player(index).EXP > GetPlayerNextLevel(index) Then
        Player(index).EXP = GetPlayerNextLevel(index)
        Exit Sub
    End If
```
Well, that's it. Goodbye :D
(Credits goes to me.)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...