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

[Correction] Player_HighIndex


iHero
 Share

Recommended Posts

**Description**

When a player disconnects, the Player_HighIndex is not updated.

**Server~Side**

> modServerTCP

In _S__ub CloseSocket_ below:

```
Call ClearPlayer(index)
```
Add:

```
       Dim i As Integer
       ' re-set the high index
        Player_HighIndex = 0
        For i = MAX_PLAYERS To 1 Step -1
            If IsConnected(i) Then
                Player_HighIndex = i
                Exit For
            End If
        Next
        ' send the new highindex to all logged in players
        SendHighIndex
```
**Credits**

Me
Link to comment
Share on other sites

```
Dim i As Long

```
**All sub**

```
Sub CloseSocket(ByVal Index As Long)
    Dim i As Long
        If Index > 0 Then
            Call LeftGame(Index)
            Call TextAdd("Connection from " & GetPlayerIP(Index) & " has been terminated.")
            frmServer.Socket(Index).Close
            Call UpdateCaption
            Call ClearPlayer(Index)

            ' re-set the high index
            Player_HighIndex = 0
            For i = MAX_PLAYERS To 1 Step -1
                If IsConnected(i) Then
                    Player_HighIndex = i
                    Exit For
                End If
            Next
            ' send the new highindex to all logged in players
            SendHighIndex

        End If

End Sub

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