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

RTE 340 : Control array element '71' doesn't exist


erkro1
 Share

Recommended Posts

Well, I was working on my guild system and after I did some edits I got that error, he's selecting this line:
```
If frmServer.Socket(Index).state = sckConnected Then
```
In this function:
```
Function IsConnected(ByVal Index As Long) As Boolean

    If frmServer.Socket(Index).state = sckConnected Then
        IsConnected = True
    End If

End Function
```
Index=71
sckConnected=7
IsConnected=False

If you need more information, ask. ;)
Link to comment
Share on other sites

@Lightning:

> If you have kept the player limit at 70, then your server has not created "Socket(71)" at load up. You've obviously gone one too many in a loop, or you have just forgotten to create the new socket.

Well, it happens when I delete a guild, code for deleting guild:
```
Public Sub DismissFromGuild(ByVal UserIndex As Long, ByVal DismissName As String)
Dim i As Integer
Dim GuildIndex As Integer
Dim tmpName As String
Dim Temp As String
Dim X As Integer
Dim Y As Integer
Dim PlayerIndex As Integer
Dim LoopC As Integer
Dim LoopG As Integer
Dim LoogH As Integer

If Player(UserIndex).GuildID = 0 Then
Call PlayerMsg(UserIndex, "You are not in a guild!", BrightRed)
Exit Sub
End If

'Make sure they're in a guild
If Player(UserIndex).GuildID > 0 Then
GuildIndex = Player(UserIndex).GuildID

'If we are the Guild Owner, delete the guild
If GetPlayerName(UserIndex) = Trim$(Guilds(GuildIndex).Owner) Then

'Get the index of the name we're dismissing
If DismissName = GetPlayerName(UserIndex) Then

    For i = 1 To Guilds(GuildIndex).NumMembers
        'Eh if we dismissed ourselves, destroy the guild
        For PlayerIndex = 1 To MAX_PLAYERS
            If IsPlaying(PlayerIndex) = True Then
                If Guilds(GuildIndex).Members(i) = GetPlayerName(PlayerIndex) Then
                Call PlayerMsg(PlayerIndex, "The guild has been dissolved!", BrightRed)
                Player(PlayerIndex).GuildID = 0
                Call SendPlayerData(PlayerIndex)
                End If
            End If
        Next PlayerIndex
    'We keep Guild Data in the Guild.data files however we flag them as 'Deleted'
    Guilds(GuildIndex).Members(i) = vbNullString
    Next i
    Kill (App.Path & "\data\guilds\" & "guild" & GuildIndex & ".dat")
    NumGuilds = NumGuilds - 1
    Call SaveGuilds
    Call DismissedGuild(PlayerIndex)
    Exit Sub
End If

Dim OldIndex As Integer

For LoopG = 1 To Guilds(GuildIndex).NumMembers
    tmpName = Guilds(GuildIndex).Members(LoopG)
    If tmpName = DismissName Then

        For LoopC = 1 To MAX_PLAYERS
            If IsPlaying(LoopC) = True Then
                If GetPlayerName(LoopC) = DismissName Then
                Player(LoopC).GuildID = 0
                Call PlayerMsg(LoopC, "You have been dismissed from the guild!", BrightRed)
                Call DismissedGuild(LoopC)
                Call SendPlayerData(LoopC)
                End If
            End If
        Next LoopC
    OldIndex = LoopG
    End If

Next LoopG
If Guilds(GuildIndex).NumMembers > 0 Then
Guilds(GuildIndex).NumMembers = 0
Guilds(GuildIndex).Members(OldIndex) = vbNullString
Call SaveGuilds
Call DismissedGuild(PlayerIndex)
Call SendPlayerData(PlayerIndex)
End If
Else

'Get the index of the name we're dismissing
If DismissName = GetPlayerName(UserIndex) Then

For LoopH = 1 To Guilds(GuildIndex).NumMembers
    If Guilds(GuildIndex).Members(LoopH) = DismissName Then
        Guilds(GuildIndex).Members(LoopH) = vbNullString
        X = LoopH + 1

        ' This will move the members up by 1 in the list getting rid
        For Y = X To Guilds(GuildIndex).NumMembers
            Temp = Guilds(GuildIndex).Members(i) ' Store the next player
            Guilds(GuildIndex).Members(i - 1) = Temp
        Next

        'Remove last slot
        Guilds(GuildIndex).Members(Guilds(GuildIndex).NumMembers) = vbNullString
    End If
Next

Guilds(GuildIndex).NumMembers = Guilds(GuildIndex).NumMembers - 1
Player(UserIndex).GuildID = 0
Call PlayerMsg(UserIndex, "You've succesfully leaved the guild", Green)
Call SaveGuilds
Call DismissedGuild(UserIndex)
Call SendPlayerData(UserIndex)
End If
End If
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...