Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error Message + Server Down
#1
So as I was just tinkering around with my source, I noticed that whenever you had the wrong password for logging in or deleting your account, it would always tell you Incorrect Password, which is perfectly fine, but then a second message box would appear stating that the server is offline.

So if we look at the MenuState sub, we see that after all the Cases, there is a snippet which says :

Code:
If Not IsConnected Then
        frmMainMenu.Visible = True
        frmSendGetData.Visible = False
        Call MsgBox("Sorry, the server seems to be down.  Please try to reconnect in a few minutes or visit " & WEBSITE, vbOKOnly, GAME_NAME)
    End If

This basically tells you if the server is down. So this is the line that is appearing the message box. Why? Because the IncorrectPassword line is a AlertMsg, which disconnects you. So let's look at the login and delete states :

Code:
Case MENU_STATE_DELACCOUNT
            frmDeleteAccount.Visible = False
            If ConnectToServer = True Then
                Call SetStatus("Connected, sending account deletion request ...")
                Call SendDelAccount(frmDeleteAccount.txtName.Text, frmDeleteAccount.txtPassword.Text)
                
            End If
        
        Case MENU_STATE_LOGIN
            frmLogin.Visible = False
            If ConnectToServer = True Then
                Call SetStatus("Connected, sending login information...")
                Call SendLogin(frmLogin.txtName.Text, frmLogin.txtPassword.Text)
                
            End If

As you can see, those lines use the ConnectToServer function, which returns false if the server is down, so there is already a check. The reason for the second message box to appear is because the code keeps on going down, and by the time it checks whether it is connected or not, the connection has been broken by the Incorrect Password alert message.

So just replace that code with :

Code:
Case MENU_STATE_DELACCOUNT
            frmDeleteAccount.Visible = False
            If ConnectToServer = True Then
                Call SetStatus("Connected, sending account deletion request ...")
                Call SendDelAccount(frmDeleteAccount.txtName.Text, frmDeleteAccount.txtPassword.Text)
                Exit Sub
            End If
        
        Case MENU_STATE_LOGIN
            frmLogin.Visible = False
            If ConnectToServer = True Then
                Call SetStatus("Connected, sending login information...")
                Call SendLogin(frmLogin.txtName.Text, frmLogin.txtPassword.Text)
                Exit Sub
            End If

And there you go, now it exits the sub once the login has been sent, because it knows that the server is online, and the incorrect password message will still appear.

Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)