I recently added HDSN banning to my engine and I'm sort of stumped with the run time error 9 I'm getting. It'd be better to just post it rather than try to explain.
Code:
Function IsBanned(ByVal IP As String) As Boolean
Dim FileName As String, fIP As String, fName As String
Dim f As Long
'Dim b As Integer
Dim BIp As String
Dim I As Integer
IsBanned = False
FileName = App.Path & "\banlist.ini"
For I = 0 To MAX_BANS
If Ban(I).BannedIP <> "" Then
BIp = Ban(I).BannedIP
If IP = BIp Then
IsBanned = True
Exit Function
Else
IsBanned = False
End If
End If
Next I
End Function
The line that is highlighted is
Code:
If Ban(I).BannedIP <> "" Then
When I hold my mouse over it I get...
Code:
Ban(I).BannedIP = <Subscript out of range>
If anyone can help that'd be really cool. Thanks.
Edit* Same exact thing with.
Code:
Function IsBannedHD(ByVal HD As String) As Boolean
Dim FileName As String
Dim bHD As String
Dim I As Integer
IsBannedHD = False
FileName = App.Path & "\banlist.ini"
For I = 0 To MAX_BANS
If Ban(I).BannedHD <> "" Then
bHD = Ban(I).BannedHD
If HD = bHD Then
IsBannedHD = True
Exit Function
Else
IsBannedHD = False
End If
End If
Next I
End Function
On line
Code:
If Ban(I).BannedHD <> "" Then
and when I hover over it it gives me the same basic thing as above.
If I try to put On Error Resume Next it just says I'm banned from the server so go figure -_-.