Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to convert to binary... Small bug
#1
I guess theres a bug I can succesfully create an account with no problem but when I try to login it says wrong password

Heres my Passwordok function

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

I been trying alot to make it load right but I cant make it work >.
Reply
#2
I had a similar problem, try removing the
Code:
RightPassword = Player(Index).Password
Reply
#3
Commented it before didnt work.
Reply
#4
Heres a little debugging hint - try putting stoppers (click the left side of the screen and place the dot on the line) then when the code stops at that line, move the mouse over certain variables to see if they are what they should be. One good place to check is the password you are recieving. Hope that helps! 8)
Reply
#5
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 Tongue

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)
Reply
#6
Ok Tried different things I still couldnt get it to work
Reply
#7
When you save the accounts, do you use.

Code:
Put CharName, , RightPassword

CharName of course might be different, but the RightPassword part.
Reply
#8
Code:
Get Trim(Name), , Rightpassword

by leaving it blank, you don't know where it is taking it from(probably from the start of the file)...noooooo....tell it what to do!!!

Code:
Password = Rightpassword
Why?!
Password is what they guessed!

Code:
Rightpassword = Player(Index).Password
you dont even know what index is!, the player hasn't been loaded! noo! baddd!
Reply
#9
oK ill try it later school started and I cant be on pc >,> all I can do is homework =(
Reply
#10
I live in mexico im in high school and we started 2 days ago 7am to 3pm is the time I have to be in school but its worth it because I leave as a profesionist Tongue
Reply
#11
well its not like...oh poof im professional right when you get out of school Tongue.

And those are about the same hours you have that we have for school(though school doesnt start till the begining of september for me)
Reply
#12
7am!?

If we had school at 7am I would have to get up at... at... 5am!! :O

We have school at about 8:30, but I need to get two trains to get there.
Reply
#13
Kite Wrote:7am!?

If we had school at 7am I would have to get up at... at... 5am!! :O

We have school at about 8:30, but I need to get two trains to get there.

Two Trains? How a terrible way of starting the day... xD. My Schools like 30 meter from my home.
Reply
#14
Lucky :S

But I do get a chance to grab a Latté whilst switching trains so it's not all bad.

Anyway, tell us if you manage to sort out your problem!
Reply
#15
Dave Wrote:my school is a 15 minute car ride, or a 25 minute bus ride. I get up at 6:00 in the morning, get to school at 7:00 and school officially starts at 7:25.

yay wisconsin!


i have to walk to school ^^, i get up at 6:50, leave my house at 7:30 and school starts at 8:05, so 35 mins way :/
Reply
#16
Quote:my school is a 15 minute car ride, or a 25 minute bus ride. I get up at 6:00 in the morning, get to school at 7:00 and school officially starts at 7:25.

yay wisconsin!

Wow its the same here, though I wake up 15 minutes later and get to school 15 minutes later...but I think it starts at 7:25.

Oh, and I'm in a good state xD
Reply
#17
Thread went a bit offtopic xDDD


Well I got it working now when I try to change the classes I get a bug I think i will leave it for another time for now I think the accs are only the binary thing needed Tongue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)