02-08-2006, 12:58 AM
Code:
Function PasswordOK(ByVal Name As String, ByVal Password As String) As Boolean
Dim FileName As String
'Dim RightPassword As String
Dim RightPassword As String * NAME_LENGTH
Dim nFileNum As Integer
PasswordOK = False
If AccountExist(Name) Then
nFileNum = FreeFile
Open FileName For Binary As #nFileNum
FileName = App.Path & "\Accounts\" & Trim(Name) & ".zap"
Get #nFileNum, 20, RightPassword '= nFileNum.Password
RightPassword = Player(Index).Password
If UCase(Trim(Password)) = UCase(Trim(RightPassword)) Then
PasswordOK = True
End If
End If
End Function
Tell me...why are you setting the file name after you need to open it using the filename? that doesn't seem smart. nor like that would even work

as for rightpassword = player(index).password. You are doing this before you load the entire account, therefore the player rec won't have any data in it. not to mention that the sub doesn't even know what index is. its not passed(nor should it be). You're also assuming rightpassword is 20 bytes from the start of the file. Is that still true(it might have been true for the person writing the tutorial, but you're game could be different)