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

'addchar' packet


Zananok
 Share

Recommended Posts

Obviouly a packet of 'addchar' will create the character on the 'Accounts' folder. So i made the login code like the client does, but I can't put them together… I did it 1 time.. but i was to hasty editing to fix the problem that when i realised that i fixed it... it was ruinned again -.-

Easy explanation:
Need a working (php) code for 'Character' creation. Don't need to make it nice or specific, I can fix that later.

Or

Help on the one i currently have worked on...

Thanks in advance,

Comments,
From: Zananok
Link to comment
Share on other sites

Here is where I'm stuck (small part of the code):

$input = 'acclogin'.$SEP_CHAR.$username.$SEP_CHAR.$password.$SEP_CHAR.$major.$SEP_CHAR.$minor.$SEP_CHAR.'0'.$SEP_CHAR.'270'.$SEP_CHAR.$END_CHAR;
$input2 = 'addchar'.$SEP_CHAR.$name.$SEP_CHAR.$gender.$SEP_CHAR.$class.$SEP_CHAR.'1'.$SEP_CHAR.''.$SEP_CHAR.''.$SEP_CHAR.''.$SEP_CHAR.$END_CHAR;

$post = socket_write($socket, $input, strlen($input));
$post1 = socket_write($socket, $input2, strlen($input2));

This should be enough, since it connects and login, then while still login, it creates the char. But it doesn't… tried many different similar ways...

Any ideas?
Thanks in advance (again),

Comments,
From: Zananok
Link to comment
Share on other sites

@dg1423:

> I threw this together last night:
>
> http://dg1423.getmyip.com/ttest/test.phps

Thanks, it helped me.
@dg1423:

> You still have to confirm login and it'd be best if you saved account info in a session.

I'm planning on doing that  ;)

But, strangely I'm getting the same error as i got before with one of my different tries:
```
trying to read...

Array ( [0] => ALLCHARS [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] => [21] => [22] => Vagrant [23] => 0 [24] => [25] => [26] => [27] => [28] => [29] => [30] => [31] => [32] => [33] => [34] => [35] => [36] => [37] => [38] => [39] => [40] => [41] => [42] => [43] => [44] => [45] => Vagrant [46] => 0 [47] => [48] => [49] => [50] => [51] => [52] => [53] => [54] => [55] => [56] => [57] => [58] => [59] => [60] => [61] => [62] => [63] => [64] => [65] => [66] => [67] => [68] => Vagrant [69] => 0 [70] => í )

trying to read...

Array ( [0] => PLAINMSG [1] => Character already exists! [2] => 4í )
```But I already have noticed that when you 'login' and there is no 'char' DAT file on the folder, it auto-creates all 3\. Maybe that's a reason for it happening, maybe it checks if there is a DAT file. Weirdly we know that the code works for the client.. so it should work…

Here are my test settings:
```
$USERNAME = "username";
$PASSWORD = "pass";

$CHARNAME = "Pizza";
$SEX = 1;
$CLASS = 0;
$CHARNUM = 1;
$HEAD = "";
$BODY = "";
$LEGS = "";

```

Thanks again and sorry for the trouble.

Comments,
From: Zananok
Link to comment
Share on other sites

I know that, I went to the source looking for the sec code and the revision :P.
Don't worry, I already checkt many times, and the real warning it give us if the name is in use is:
```
Sorry, but that name is in use!
```The code never works for me unless i give a wrong account name or password, but when that happens it creates the chars on the account folder.

Here are the full details:

I have an account test:
```
User name = username
Password = pass
Char1 = empty
Char2 = empty
Char3 = empty

```Using this settings on the page:
```
$USERNAME = "username";
$PASSWORD = "pass";
$CHARNAME = "Pizza";
$SEX = 1;
$CLASS = 0;
$CHARNUM = 1;
$HEAD = "";
$BODY = "";
$LEGS = "";

```CharList.txt: Empty (deleted all names [copied to a backup txt :P])

Response I get:
```
trying to read...

Array ( [0] => ALLCHARS [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] => [21] => [22] => Vagrant [23] => 0 [24] => [25] => [26] => [27] => [28] => [29] => [30] => [31] => [32] => [33] => [34] => [35] => [36] => [37] => [38] => [39] => [40] => [41] => [42] => [43] => [44] => [45] => Vagrant [46] => 0 [47] => [48] => [49] => [50] => [51] => [52] => [53] => [54] => [55] => [56] => [57] => [58] => [59] => [60] => [61] => [62] => [63] => [64] => [65] => [66] => [67] => [68] => Vagrant [69] => 0 [70] => í )

trying to read...

Array ( [0] => PLAINMSG [1] => Character already exists! [2] => 4í )
```Nothing happens on the 'accounts' folder;

Reply I get if i change the user name or the password to one that's not compatible with no accounts on my server:
```
trying to read...

Array ( [0] => PLAINMSG [1] => You've entered an incorrect password. [2] => 3í )

trying to read...

Array ( [0] => ALLCHARS [1] => Pizza [2] => Vagrant [3] => 1 [4] => [5] => Vagrant [6] => 0 [7] => [8] => Vagrant [9] => 0 [10] => í )
```Create 3 char DAT files on the 'accounts' folder and saves the name on the 'CharList.txt' file;

Reply I get if i change the user name or the password to one that's not compatible with no accounts on my server, but don't delete the name on the 'CharList.txt':
```
trying to read...

Array ( [0] => PLAINMSG [1] => You've entered an incorrect password. [2] => 3í )

trying to read...

Array ( [0] => PLAINMSG [1] => Sorry, but that name is in use! [2] => 4í )
```Nothing happens on the 'accounts' folder.

Sorry again and thanks for the trouble…

Edit: oh and i agree... it's weird...

Edit2:
Found on the source:

    If CharExist(Index, CharNum) Then
        Call PlainMsg(Index, "Character already exists!", 4)
        Exit Sub
    End If

Function CharExist(ByVal Index As Long, ByVal CharNum As Long) As Boolean
    If Trim$(Player(Index).Char(CharNum).Name) <> vbNullString Then
        CharExist = True
    Else
        CharExist = False
    End If
End Function

For  me it seems fine...
Comments,
From: Zananok
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...