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

[EO] Automatic System Resets


iHero
 Share

Recommended Posts

**Client~Side**

At the end of Type End Type PlayerRec before add:

```
    Resets As Long
```
Search by:

```
    Call SetPlayerPK(i, Buffer.ReadLong)
```
Add bellow:

```
    Call SetPlayerResets(i, Buffer.ReadLong)
```
Search by:

```
Sub SetPlayerPK(ByVal Index As Long, ByVal PK 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 Sub
    Player(Index).PK = PK

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "SetPlayerPK", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
Add below:

```
Function GetPlayerResets(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
    GetPlayerResets = Player(Index).Resets

    ' Error handler
    Exit Function
errorhandler:
    HandleError "GetPlayerResets", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Function
End Function

Sub SetPlayerResets(ByVal Index As Long, ByVal Resets 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 Sub
    Player(Index).Resets = Resets

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "SetPlayerResets", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
**Serve~Side**

At the end of Type End Type PlayerRec before add:

```
    Resets As Long
```
Search by:

```
    Buffer.WriteLong GetPlayerPK(index)
```
Add bellow:

```
    Buffer.WriteLong GetPlayerResets(index)
```
At the end of Sub CheckPlayerLevelUp before the End Sub, add:

```
    If GetPlayerLevel(index) = 1000 Then ' Mude o 1000 para o level nessessario para resetar
        Call PlayerMsg(index, "Congratulations " & GetPlayerName(index) & " you have just reset", 15)
        Call SendAnimation(1, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index)) ' 'Change the number 1 for the number of which appeared to reset animation
        Call SetPlayerLevel(index, 1) 'Return to level 1
        Call SetPlayerExp(index, 1) 'Return to experience 1
        Call setplayerResets(index, GetPlayerResets(index) + 1)
        Call SendPlayerData(index)  'Save the player
        Call SendEXP(index)  'Saves the experience of the player
    End If
```
Search by:

```
Sub SetPlayerPK(ByVal index As Long, ByVal PK As Long)
    Player(index).PK = PK
End Sub
```

Add bellow:

```
Function GetPlayerResets(ByVal index As Long) As Long
    If index > MAX_PLAYERS Then Exit Function
    GetPlayerResets = Player(index).Resets
End Function

Sub SetPlayerResets(ByVal index As Long, ByVal Resets As Long)
    Player(index).Resets = Resets
End Sub
```
Credits:

iHero
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...