erkro1 Posted November 12, 2011 Author Share Posted November 12, 2011 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 IfEnd Function```Index=71sckConnected=7IsConnected=FalseIf you need more information, ask. ;) Link to comment Share on other sites More sharing options...
Yxxe Posted November 12, 2011 Share Posted November 12, 2011 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. Link to comment Share on other sites More sharing options...
erkro1 Posted November 12, 2011 Author Share Posted November 12, 2011 @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 IntegerDim GuildIndex As IntegerDim tmpName As StringDim Temp As StringDim X As IntegerDim Y As IntegerDim PlayerIndex As IntegerDim LoopC As IntegerDim LoopG As IntegerDim LoogH As IntegerIf Player(UserIndex).GuildID = 0 ThenCall PlayerMsg(UserIndex, "You are not in a guild!", BrightRed)Exit SubEnd If'Make sure they're in a guildIf Player(UserIndex).GuildID > 0 ThenGuildIndex = Player(UserIndex).GuildID'If we are the Guild Owner, delete the guildIf GetPlayerName(UserIndex) = Trim$(Guilds(GuildIndex).Owner) Then'Get the index of the name we're dismissingIf 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 SubEnd IfDim OldIndex As IntegerFor 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 IfNext LoopGIf Guilds(GuildIndex).NumMembers > 0 ThenGuilds(GuildIndex).NumMembers = 0Guilds(GuildIndex).Members(OldIndex) = vbNullStringCall SaveGuildsCall DismissedGuild(PlayerIndex)Call SendPlayerData(PlayerIndex)End IfElse'Get the index of the name we're dismissingIf DismissName = GetPlayerName(UserIndex) ThenFor 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 IfNextGuilds(GuildIndex).NumMembers = Guilds(GuildIndex).NumMembers - 1Player(UserIndex).GuildID = 0Call PlayerMsg(UserIndex, "You've succesfully leaved the guild", Green)Call SaveGuildsCall DismissedGuild(UserIndex)Call SendPlayerData(UserIndex)End IfEnd IfEnd IfEnd Sub``` Link to comment Share on other sites More sharing options...
Yxxe Posted November 12, 2011 Share Posted November 12, 2011 Place a breakpoint at the beginning of the sub and step through. Post the line in that procedure it errors on. Link to comment Share on other sites More sharing options...
Robin Posted November 12, 2011 Share Posted November 12, 2011 You're passing the wrong variable or something. You should have handlers in place to exit out early if you're trying to deal with something outside the subscript range. Link to comment Share on other sites More sharing options...
erkro1 Posted November 12, 2011 Author Share Posted November 12, 2011 Nevermind, fixed Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now