abhi2011 Posted May 4, 2012 Author Share Posted May 4, 2012 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 = picDelAccountBack Colour = &H00000000& Height = 210Width = 442Left = 37Top = 44```2 Labels With caption username and password for indication purposes 2 Textboxes> Name = txtDUser and txtDPass> Text = ""Label```Name = lblDAcceptCaption = 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 Iferrorhandler: 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 modGeneralReplace```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 More sharing options...
abhi2011 Posted May 4, 2012 Author Share Posted May 4, 2012 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 Iferrorhandler: 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 More sharing options...
tslusny Posted May 5, 2012 Share Posted May 5, 2012 nice tut i will use this for my game. Nice job :cheesy: Link to comment Share on other sites More sharing options...
abhi2011 Posted May 5, 2012 Author Share Posted May 5, 2012 @tslusny:> nice tut i will use this for my game. Nice job :cheesy:Thanks. I tried chnage pass. Wasnt easy. Will try again later. Currently i am trying a report system! Link to comment Share on other sites More sharing options...
tslusny Posted May 5, 2012 Share Posted May 5, 2012 Wow report system will be epic. Good Luck :cheesy: Link to comment Share on other sites More sharing options...
abhi2011 Posted May 5, 2012 Author Share Posted May 5, 2012 @tslusny:> Wow report system will be epic. Good Luck :cheesy:thanks again! don't leak it! :) Want to be the first one 1 release the source. Erwin already has 1\. but no tut! Link to comment Share on other sites More sharing options...
tslusny Posted May 5, 2012 Share Posted May 5, 2012 btw why make new picDelete, you can just add lblDelete to login menu and change code to read from login textboxes Link to comment Share on other sites More sharing options...
abhi2011 Posted May 5, 2012 Author Share Posted May 5, 2012 @tslusny:> btw why make new picDelete, you can just add lblDelete to login menu and change code to read from login textboxesIf 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 asur are removing 1 step. But what i did was just copy paste piclogin and change the back colour and height :DIf u want to knoe how to remoce picdelaccount pm me! Link to comment Share on other sites More sharing options...
tslusny Posted May 6, 2012 Share Posted May 6, 2012 i can hold it myself, i want to make it on login screen becouse im too lazy to make new button and picdelete image :cheesy: Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 @tslusny:> i can hold it myself, i want to make it on login screen becouse im too lazy to make new button and picdelete image :cheesy:okay Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now