| Mirage Source http://www.miragesource.net/forums/ |
|
| accessing an offline account http://www.miragesource.net/forums/viewtopic.php?f=210&t=292 |
Page 1 of 1 |
| Author: | Dr. Spoon [ Sun Jul 16, 2006 8:04 pm ] |
| Post subject: | accessing an offline account |
with only the character name ONLY SERVER SIDE make a new module and name it modOfflineAccount add all of this code to it Code: Type TempAccountRec Login As String * NAME_LENGTH Password As String * NAME_LENGTH Char(1 To MAX_CHARS) As PlayerRec End Type Public TempAccount As TempAccountRec Sub GetChar(ByVal Name As String) Dim f As Long Dim s As String, X As Long f = FreeFile frmServer.fileList.Path = App.Path & "\accounts" For X = 0 To frmServer.fileList.ListCount Open (frmServer.fileList.Path & "/" & frmServer.fileList.List(X)) For Input As #f Do While Not EOF(f) Input #f, s If Trim(LCase(s)) = ("name=" & Trim(LCase(Name))) Then Close #f Call LoadTempAccount(frmServer.fileList.List(X)) Exit Sub End If Loop Close #f Next X End Sub need to make a file list on frmServer named fileList set its filter to *.ini set its visibility to false then you need these two subs but with your specific code in them.. Code: Sub LoadTempAccount(ByVal Name As String)
Dim FileName As String Dim n As Long, X As Byte FileName = App.Path & "\accounts\" & Trim(Name) TempAccount.Login = Trim(GetVar(FileName, "GENERAL", "Login")) TempAccount.Password = Trim(GetVar(FileName, "GENERAL", "Password")) For X = 1 To MAX_CHARS With TempAccount.Char(X) 'place a copy of your load player Sub here End With Next X End Sub Sub ClearTempAccount() Dim n As Long, X As Byte TempAccount.Login = "" TempAccount.Password = "" For X = 1 To MAX_CHARS With tempAccount.Char(X) 'place a copy of your clear player Sub here End With Next X End Sub now what this will do is find out which accoutn the character name belongs to then load in that account to the TempAccount array allowing you to change anything in it you wish to change then you can save it and be done with it the saveing sub is something you can figure out on your own from the code provided i am sure the clear TempAccount sub is used to erase the info server side enjoy |
|
| Author: | Xentar [ Sun Jul 16, 2006 8:28 pm ] |
| Post subject: | |
IDOL! lets try it right now ^^, thx man |
|
| Author: | Dr. Spoon [ Wed Jul 19, 2006 5:03 pm ] |
| Post subject: | |
well how did it work out for you? just curious.. would like some sort of feed back |
|
| Author: | Leighland [ Wed Jul 19, 2006 5:32 pm ] |
| Post subject: | |
I'm messing with this right now, I'll tell ya how it works out |
|
| Author: | Leighland [ Wed Jul 19, 2006 5:42 pm ] |
| Post subject: | |
Code: Sub GetChar(ByVal Name As String) Dim f As Long Dim s As String, X As Long f = FreeFile frmServer.fileList.Path = App.Path & "\accounts" For X = 0 To frmServer.fileList.ListCount Open (frmServer.fileList.Path & "/" & frmServer.fileList.List(X)) For Input As #f Do While Not EOF(f) Input #f, s If Trim(LCase(s)) = ("name=" & Trim(LCase(Name))) Then Close #f Call LoadTempAccount(frmServer.fileList.List(X)) Exit Sub End If Loop Close #f Next X End Sub This gives me an error on this line: Code: Open (frmServer.fileList.Path & "/" & frmServer.fileList.List(X)) For Input As #f - Path not found. Tried this and it also fails to work: Code: Open (frmServer.fileList.Path & "\" & frmServer.fileList.List(X)) For Input As #f
- File not found |
|
| Author: | Obsidian [ Wed Jul 19, 2006 6:05 pm ] |
| Post subject: | |
if you've changed your accounts path... or the accounts folder doesn't exist, that could be the reason why. You might also try frmServer.fileList.Path = App.Path & "accounts" That might fix it. Just play with that for a bit and see what you can do. |
|
| Author: | Leighland [ Wed Jul 19, 2006 6:49 pm ] |
| Post subject: | |
Meh I gave up ... confused myself... I'l take anothe rstab at it when I'm not tired lol. |
|
| Author: | Gilgamesch [ Fri Jul 21, 2006 10:23 am ] |
| Post subject: | |
is there a "index" for this tem account? :/ cuz tahts what i need if i call a sub or function for example, it always is like that: getplayersomething(index as long, bla bla) oh, and how can i get the charnum for the char? thanks |
|
| Author: | Dr. Spoon [ Sat Jul 22, 2006 6:50 am ] |
| Post subject: | |
if you only want the char number of the specific character all you would have to do is scan the right account for the char name to see which one matches it this code takes the characters name and finds the right acocunt by scanning them all if you want to find the specific char number just add in something like this to the already present GetChar sub it would go into the spot where it calls the load temp account Code: dim File as string
File = app.path & "\" & frmserver.FileList.list(frmserver.FileList.listindex) for x = 1 to Max_Chars If getvar(File, "CHAR" & X, "Name") = Name then CharNum = X Exit Sub End If next x that should about do it any more questions? and no there is no index for this acocunt becaouse it isn't connected via a client i am sureyou could set one up for it |
|
| Author: | Gilgamesch [ Sat Jul 22, 2006 10:24 am ] |
| Post subject: | |
since you asked if we got more questions, how would you set that up? |
|
| Author: | Dr. Spoon [ Mon Jul 24, 2006 3:49 am ] |
| Post subject: | |
add something like this to the already present GetChar sub it would go into the spot where it calls the load temp account that is what i said in that short narative above the bit of code that is were you would put it and it would retrieve the charNum .. which is what you requested are you having any specific problems with any part of the code? |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|