Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Delete account!


abhi2011
 Share

Recommended Posts

This is my second tutorial and credits go to Robin for writing the packet which was already added when EO 2 was released and to me for writing the rest of the code.

                    There is nothing in server side!!! Only Client side!

Client Work (frmMenu)

Picture Box
```
Name = picDelAccount
Back Colour = &H00000000&
Height = 210
Width = 442
Left = 37
Top = 44
```
2 Labels With caption username and password for indication purposes 

2 Textboxes

> Name = txtDUser and txtDPass
> Text = ""

Label
```
Name = lblDAccept
Caption = Accept
```
Now add another label underneath any of the buttons and name it "lblDel" and caption
"Delete account"

Now double click "lbldel" and add the following piece of code

```
If Not picDelAccount.Visible Then
        ' destroy socket, change visiblity
        DestroyTCP
        picDelAccount.Visible = True
        picCredits.Visible = False
        picLogin.Visible = False
        picRegister.Visible = False
        picCharacter.Visible = False
        picMain.Visible = False
        ' play sound
        PlaySound Sound_ButtonClick
    End If
```
Now in the sub
```
Private Sub imgButton_Click(Index As Integer)
```
Above 'play sound add
```
picDelAccount.Visible = False
```
Then in the click even of lblDAccept add
```
  ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If isLoginLegal(txtDUser.text, txtDPass.text) Then
        Call MenuState(MENU_STATE_DELACCOUNT)
    End If

errorhandler:
    HandleError "lblDAccept_Click", "frmMenu", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
```
Now in the sub

```
Public Sub MenuState(ByVal state As Long)
```in modGeneral

Replace

```
Select Case state
        Case MENU_STATE_ADDCHAR
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, sending character addition data...")

                If frmMenu.optMale.Value Then
                    Call SendAddChar(frmMenu.txtCName, SEX_MALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite)
                Else
                    Call SendAddChar(frmMenu.txtCName, SEX_FEMALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite)
                End If
            End If

        Case MENU_STATE_NEWACCOUNT
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, sending new account information...")
                Call SendNewAccount(frmMenu.txtRUser.text, frmMenu.txtRPass.text)
            End If

        Case MENU_STATE_LOGIN
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, sending login information...")
                Call SendLogin(frmMenu.txtLUser.text, frmMenu.txtLPass.text)
                Exit Sub
            End If
    End Select
```
with this

```
Select Case state
        Case MENU_STATE_ADDCHAR
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, sending character addition data...")

                If frmMenu.optMale.Value Then
                    Call SendAddChar(frmMenu.txtCName, SEX_MALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite)
                Else
                    Call SendAddChar(frmMenu.txtCName, SEX_FEMALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite)
                End If
            End If

        Case MENU_STATE_NEWACCOUNT
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, sending new account information...")
                Call SendNewAccount(frmMenu.txtRUser.text, frmMenu.txtRPass.text)
            End If

        Case MENU_STATE_LOGIN
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, sending login information...")
                Call SendLogin(frmMenu.txtLUser.text, frmMenu.txtLPass.text)
            End If

        Case MENU_STATE_DELACCOUNT
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False
            frmMenu.picDelAccount.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, Deleting account...")
                Call SendDelAccount(frmMenu.txtDUser.text, frmMenu.txtDPass.text)
                End If
                Exit Sub
        End Select
```
That's about it. I will explain what everything does later.
Again Credits go to Robin and myself
Link to comment
Share on other sites

Here is what everything does explained!

```
If Not picDelAccount.Visible Then
        ' destroy socket, change visiblity
        DestroyTCP
        picDelAccount.Visible = True
        picCredits.Visible = False
        picLogin.Visible = False
        picRegister.Visible = False
        picCharacter.Visible = False
        picMain.Visible = False
        ' play sound
        PlaySound Sound_ButtonClick
    End If
```What this piece of code does is that it will check whether picDel is currently visible or not. If not then it will make it visible.

```
picDelAccount.Visible = False
```This will make the other picdel invisible when i click on a picbutton.

```
  ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If isLoginLegal(txtDUser.text, txtDPass.text) Then
        Call MenuState(MENU_STATE_DELACCOUNT)
    End If

errorhandler:
    HandleError "lblDAccept_Click", "frmMenu", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
```This piece of code will check whether login is legal. i.e whether username and password > 3\. If so then it will call the menu state "MENU_STATE_DELACCOUNT" in sub MenuState.

```
Case MENU_STATE_DELACCOUNT
            frmMenu.Visible = False
            frmMenu.picCredits.Visible = False
            frmMenu.picLogin.Visible = False
            frmMenu.picCharacter.Visible = False
            frmMenu.picRegister.Visible = False
            frmMenu.picDelAccount.Visible = False

            If ConnectToServer(1) Then
                Call SetStatus("Connected, Deleting account...")
                Call SendDelAccount(frmMenu.txtDUser.text, frmMenu.txtDPass.text)
                End If
                Exit Sub
        End Select

```This is the new code that is added along with a few extras!

All it will do is make the frmLoad visible and all the other invisible then it will connect to server and set the status of the frmLoad (frmLoad is the small thing that notifies you of connection status and stuff.)
Then it will Send the Delete Account packet. With txtDUser and txtDPass as name and password.

That is about it. Once the packet is send the server does the rest. It validates the username and password and checks if the account exsists. If everything is fullfilled it will Kill/Delete the account in "Accounts/Name"
Link to comment
Share on other sites

@tslusny:

> btw why make new picDelete, you can just add lblDelete to login menu and change code to read from login textboxes

If u mean getting rid of picdelaccount and adding a label saying that delete account and changing the code for duser and dpass to luser and lpass well it is possible. Never actually tried it. but it is possible as
ur are removing 1 step. But what i did was just copy paste piclogin and change the back colour and height :D

If u want to knoe how to remoce picdelaccount pm me!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...