Kimimaru Posted July 16, 2009 Author Share Posted July 16, 2009 EDIT: Solved!! Putting this on the Source Tutorials board, since it requires both scripting and source editing. Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 16, 2009 Share Posted July 16, 2009 i Think that MsgBox isn't a valid command. try this way.' **Executes QueryBoxes. Sub QueryBox(index, script) Value = GetVar("responses.ini", "Responses", Cstr(index)) Select Case script' Asks player to input new password. Case 0 Select Case Value Case GetVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password") Call PlayerQueryBox(Index, "Please enter your new password.", 1)' Rejects password if it's incorrect. Case Else Call PlayerMsg(index , "I'm sorry, but that password is incorrect. Please visit me when you know your password and want to change it.", 0) Call PlayerMsg(index , "Incorrect Password!" , 0 ) End Select Case 1 Select Case Value' Asks you to input a new password if the password you inputted is the same as the current one. Case GetVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password") Call PlayerQueryBox(Index, "I'm sorry, but that's your current password. Please choose a different password.", 1) Case Else' Sets password length requirement; must be at least 3 characters long. If Len(Value) < 3 Then Call PlayerQueryBox(Index, "Your password must be at least 3 characters in length! Please choose another password.", 1) Else' Changes password. Call PutVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password", ""& Value) Call PlayerMsg(index , "Your password has been changed to: " & Value & ". Please come back to me whenever you want to change your password again.", 0) Call PlayerMsg(index , "Password Changed Successfully!" , 0 ) End If End Select End Select End Sub' Executes whenever a scripted NPC does an action.Sub ScriptedNPC(Index, Script) Select Case Script ' Allows players to change their password by talking to an NPC Case 1 Call PlayerMsg(index , "Hey, I'm the password changer. I can change your password for you.", 0) Call PlayerQueryBox(Index, "Please enter your password.", 0) Case Else Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd SubI hope i could help. Link to comment Share on other sites More sharing options...
Kimimaru Posted July 16, 2009 Author Share Posted July 16, 2009 Thanks for trying to help, but the MsgBox is a valid command. As I stated in the first post, the whole script works; it's just that it doesn't keep the new password saved when you log off and then back on. I need help saving the new password, somehow.Thanks again for trying to help. Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 16, 2009 Share Posted July 16, 2009 try to replace the line : Call PutVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password", Trim(Value))To : Call PutVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password", ""&Value) Link to comment Share on other sites More sharing options...
Kimimaru Posted July 16, 2009 Author Share Posted July 16, 2009 I tried that while I was working on the script, and it didn't work. I don't think you understand what I need help with. I need to add something, that will permanently save the password that it put in the .INI file after you've finished changing your password. It already saves the password, and I've checked that in the .INI file, but as soon as I log off and then go back on, it reverts back to the old one. Since this is the case, the password you type on login is the same as the old one, as well; however, I don't want it like that.I appreciate the help, though. Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 16, 2009 Share Posted July 16, 2009 hmm . there no command to chance the password.Ask someone that is a great scripter like MrMiguu , Admiral Refuge etc . They will help you . Bye Link to comment Share on other sites More sharing options...
Kimimaru Posted July 16, 2009 Author Share Posted July 16, 2009 This command changes the password, but not permanently:```Call PutVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password", Trim(Value))```Thanks for the concern. Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 16, 2009 Share Posted July 16, 2009 I like your scripting style Kimimaru.I think when the player logs in, his information is read from the INI from the server, and when he logs out, it updates it.You could try something like this, in the sub where the player logs out (I think it's Sub LeaveGame or something along the lines of that):Dim ValueValue = GetVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password")Call PutVar("Accounts\" & GetPlayerName(Index) & "_Info.ini", "ACCESS", "Password", Trim(Value))That way, right when the player logs out, it updates his password one last time. Link to comment Share on other sites More sharing options...
Kimimaru Posted July 16, 2009 Author Share Posted July 16, 2009 Okay, thanks a lot! I'll try that.@Admiral:> I like your scripting style Kimimaru.I'm not sure if you were being sarcastic or not, but I don't think so.EDIT: Sorry, but it didn't work. Link to comment Share on other sites More sharing options...
DarkSpine Posted July 16, 2009 Share Posted July 16, 2009 Shouldn't it be:```Call PutVar("Accounts\" & GetPlayerLogin(Index) & "_Info.ini", "ACCESS", "Password", Trim(Value))```Because in the INI's then the password is stored in the _Account's_ INI, not the player he is on. Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 16, 2009 Share Posted July 16, 2009 Wow, how could I have missed that :OYou're right, it is getplayerlogin!@Kimimaru:> I'm not sure if you were being sarcastic or not, but I don't think so.No, I wasn't being sarcastic. Link to comment Share on other sites More sharing options...
Kimimaru Posted July 16, 2009 Author Share Posted July 16, 2009 Oh, wow. That's probably why. I'll try it out. Thanks a lot guys!EDIT: Unfortunately, it still doesn't work, and I'm experiencing the same problem. Although, it is more accurate now, thanks to the slight variable change. Link to comment Share on other sites More sharing options...
DarkSpine Posted July 16, 2009 Share Posted July 16, 2009 You changed all getplayername's to GetPlayerLogin(Index)?Try running the script, and then check the file… Link to comment Share on other sites More sharing options...
Kimimaru Posted July 17, 2009 Author Share Posted July 17, 2009 Yeah, I replaced all the **GetPlayerName(Index)** variables with **GetPlayerLogin(Index)** variables. I ran the script and checked the file. Just like before, if you check it after you talk to the NPC, the password is changed; however, if you check it after you log off, the password reverts back to the original password. Link to comment Share on other sites More sharing options...
DarkSpine Posted July 17, 2009 Share Posted July 17, 2009 Try adding a putvar to the script that put's the password in a different .ini, and then in the leavegame sub, put the same putvar as the one that I fixed, but have it put a variable called "Password" so add```Dim PasswordPassword = GetVar("/Accounts/" & GetPlayerLogin(Index) & "_Info", "NEWPASSWORD", "Password")```And the first putvar I told you to add, use this```Call PutVar("/Accounts/" & GetPlayerLogin(Index) & "_Info", "NEWPASSWORD", "Password", Trim(Value))```Add that somewhere in the password script.And then in the leavegame script again, put this before the end sub```Call PutVar("Accounts\" & GetPlayerLogin(Index) & "_Info.ini", "ACCESS", "Password", Password)```If that doesn't work, I'm out of ideas. Link to comment Share on other sites More sharing options...
Kimimaru Posted July 17, 2009 Author Share Posted July 17, 2009 Thanks for the help, but unfortunately it still didn't work, and I'm still experiencing the same problem. Did I correctly install what you suggested?I put this at the top of the Leavegame Sub:```Dim PasswordPassword = GetVar("/Accounts/" & GetPlayerLogin(Index) & "_Info", "NEWPASSWORD", "Password")```After that, I put this at the bottom of the Leavegame Sub:```Call PutVar("Accounts\" & GetPlayerLogin(Index) & "_Info.ini", "ACCESS", "Password", Password)```Then, I put this in the appropriate spot in the QueryBox Sub:```Call PutVar("/Accounts/" & GetPlayerLogin(Index) & "_Info", "NEWPASSWORD", "Password", Trim(Value))``` Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 17, 2009 Share Posted July 17, 2009 I'm afraid this may be something in the server that's working as a safe-guard to prevent the pass from being changed. Maybe bobosk or ballie will know Link to comment Share on other sites More sharing options...
Kimimaru Posted July 17, 2009 Author Share Posted July 17, 2009 I'm not sure, but that's possible. Ne0n told me that I need to use timers to keep the password saved, but I'm not sure if that's correct. Maybe someone can confirm that? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 17, 2009 Share Posted July 17, 2009 @Kimimaru:> I'm not sure, but that's possible. Ne0n told me that I need to use timers to keep the password saved, but I'm not sure if that's correct. Maybe someone can confirm that?That could work if you set a timer to activate and store the password after the player is well logged out. Link to comment Share on other sites More sharing options...
Bobosk Posted July 17, 2009 Share Posted July 17, 2009 I'm gonna go ahead and say, yes, yes it is!```Sub SavePlayer(ByVal Index As Long) Dim FileName As String Dim f As Long 'File Dim I As Integer On Error Resume Next ' Save login information first FileName = App.Path & "\Accounts\" & Trim$(Player(Index).Login) & "_Info.ini" Call PutVar(FileName, "ACCESS", "Login", Trim$(Player(Index).Login)) Call PutVar(FileName, "ACCESS", "Password", Trim$(Player(Index).Password)) Call PutVar(FileName, "ACCESS", "Email", Trim$(Player(Index).Email)) ' Make the directory If LCase$(Dir(App.Path & "\Accounts\" & Trim$(Player(Index).Login), vbDirectory)) <> LCase$(Trim$(Player(Index).Login)) Then Call MkDir(App.Path & "\Accounts\" & Trim$(Player(Index).Login)) End If ' Now save their characters For I = 1 To MAX_CHARS FileName = App.Path & "\Accounts\" & Trim$(Player(Index).Login) & "\Char" & I & ".dat" ' Save the character f = FreeFile Open FileName For Binary As #f Put #f, , Player(Index).Char(I) Close #f Next IEnd SubPublic Sub LoadPlayer(ByVal Index As Long, ByVal Name As String) Dim f As Long Dim I As Integer Dim FileName As String On Error GoTo PlayerErr Call ClearPlayer(Index) ' Load the account settings FileName = App.Path & "\Accounts\" & Trim$(Name) & "_Info.ini" Player(Index).Login = Name Player(Index).Password = GetVar(FileName, "ACCESS", "Password") Player(Index).Email = GetVar(FileName, "ACCESS", "Email") ' Load the .dat For I = 1 To MAX_CHARS FileName = App.Path & "\Accounts\" & Trim$(Player(Index).Login) & "\Char" & I & ".dat" f = FreeFile Open FileName For Binary As #f Get #f, , Player(Index).Char(I) Close #f Next I Exit SubPlayerErr: Call MsgBox("Couldn't load index " & Index & " for " & Name & "!", vbCritical) Call DestroyServerEnd Sub```(Sourced) Link to comment Share on other sites More sharing options...
Kimimaru Posted July 17, 2009 Author Share Posted July 17, 2009 This looks exactly the same as my **modDataBase** on the Server side. Did you mean to make any changes to it? Link to comment Share on other sites More sharing options...
Bobosk Posted July 17, 2009 Share Posted July 17, 2009 No i didn't mean to make any changes to it, i was just posting it so you KNEW what was causing it. Link to comment Share on other sites More sharing options...
Kimimaru Posted July 17, 2009 Author Share Posted July 17, 2009 EDIT: Thank you so much, everyone! I've managed to edit it, and it works great! 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