Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Binary..
#1
I recently added the binary accounts tut that Dave posted. I can create an account and login, but I can not create an account. For some reason, when creating an account it saves it as \accounts\advocate.doa but when I create a character, it does not pass the login name, so I end up getting my character in a file named like this:

\accounts\.doa

I can not figure out for the life of me what's wrong with it.

Any help would be much appreciated.
Reply
#2
Hmmph can you update me on what you've updated so far with binary technique?

:: Pando
Reply
#3
SavePlayer, LoadPlayer, AccountExist, PasswordOK.

I think that's it.

AccountExist, I just updated the file type from ini to doa.
Reply
#4
Hmmph you should try testing if inputting anything into login username & password works. If so its most likely your PasswordOK sub.

Here you go:
Code:
Function PasswordOK(ByVal Name As String, ByVal Password As String) As Boolean
Dim FileName As String
Dim RightPassword As String * NAME_LENGTH
Dim nFileNum As Integer

    PasswordOK = False
    
    If AccountExist(Name) Then
        FileName = App.Path & "\Accounts\" & Trim$(Name) & ".dat"
        nFileNum = FreeFile
        Open FileName For Binary As #nFileNum
        
        Get #nFileNum, 20, RightPassword
        
        Close #nFileNum
        
        If UCase$(Trim$(Password)) = UCase$(Trim$(RightPassword)) Then
            PasswordOK = True
        End If
    End If
    
End Function

:: Pando
Reply
#5
That's how mine looks, aside from it being \data\accounts\

I'm thinking it's SavePlayer. But I can't find anything wrong with it.
Reply
#6
Ill give you the slight bit of my sub.

Code:
Sub SavePlayer(ByVal index As Long)
Dim FileName As String
Dim i As Long
Dim n As Long
Dim nFileNum As Integer

    FileName = App.Path & "\Accounts\" & Trim$(Player(index).Login) & ".dat"
    
    If FileExist(FileName, True) Then Kill FileName
    nFileNum = FreeFile
    Open FileName For Binary As #nFileNum

If you just modified those subs, I really don't understand what the problem could possibly be.

CAPS: SINCE YOU CHANGED IT TO DATA/ACCOUNTS/FILENAME.DOA MAKE SURE YOU UPDATE ACCOUNTEXIST AND ETC.

:: Pando
Reply
#7
I'm working with him right now... it should be completely working soon. No worries. Smile

[Edit]
2 Minutes Later........ Working.... :lol:
Reply
#8
Obviously, "Trim$(Player(index).Login)" is returning null for some reason.
Reply
#9
Lol. It was an idiot move on my behalf. I currently cleaned everything up, and moved everything inside a data folder. I forgot to add the /data in front of the /accounts in sub LoadPlayer. Lol.
Reply
#10
Obsidian Wrote:I'm working with him right now... it should be completely working soon. No worries. Smile

[Edit]
2 Minutes Later........ Working.... :lol:

:O! But but but but but I edited my post before and.. NVM lol
your good Obsidian.

:: Pando
Reply
#11
Haha, thanks pando.

Yeah they were a couple of simple mistakes, but he's got it working now. All is well.


By the way, pingu, it was returning null, because he didn't set the correct filename path in the loadplayer sub.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)