• Welcome to Valhalla Legends Archive.
 

[c++] 0x0a

Started by mentalCo., July 16, 2004, 01:23 PM

Previous topic - Next topic

mentalCo.

why do i get disconnected when sending 0x0a?

packetbuf.clear();
packetbuf.insert(username);
packetbuf.insert((int)0);
packetbuf.sendpacket(bnetfd, 0x0a);

should this be different?

Eli_1

#1
Have you tried packet logging what your bot sends and comparing it to the 0x0a the real client sends?

mentalCo.

yup.  sent the exact packet. still get disconnected.

ChR0NiC

#3
Quote from: mentalCo. on July 16, 2004, 01:23 PM
why do i get disconnected when sending 0x0a?

packetbuf.clear();
packetbuf.insert(username);
packetbuf.insert((int)0);
packetbuf.sendpacket(bnetfd, 0x0a);

should this be different?

Well, I am unsure how you have decided to do your packetbuffer class, but it looks like you did "Insert" on both the Username and the Statstring. And it's fine, you are allowed to just insert 0x0 for the statstring, but since I doubt you would "Null Terminate" a single integer, it looks like you are not Null Terminating your Username. So make sure you are sending a null terminated username.

Edit: And if you are, make sure you are not null terminated the 0x0 byte you are inserting for the statstring.

UserLoser.

#4
Just a thought, doing (int)0 might convert it to two bytes to be a WORD when it should just be one BYTE? Try (unsigned char)0

Edit: or a DWORD?  Doesn't matter, because the whole point is it should just be one byte (unsigned char)0

mentalCo.

#5
i wasnt null terminating my username lol.  ill try it now i just got unbanned.

edit: if i were to use a statstring whats the format? thx

ChR0NiC

#6
Make sure it works first, before you start  trying to get all fancy.

Edit: The statstring only works for old clients that don't require cd keys, for cdkey'd products you just send null

mentalCo.

still isnt working.  i sent the exact packet from a real client.  do i send 0x0c first? im out of ideas.

hismajesty

0x0C should be sent last of the three packets that are sent at that time.

ChR0NiC

#9
Well you need to SID_ENTERCHAT before you SID_JOINCHANNEL. So you send 0x0A first then 0x0C. But it is not necessary to send 0x0C, until you wish to join a channel.

Can you post a packet log please?? I am curious of the problem now ;D


Edit: Damn Trust beat me to it >:(

Maddox

Should be...
Quote
packetbuf.insert(username);
packetbuf.insert("");
packetbuf.sendpacket(bnetfd, 0x0a);

You were sending the statstring as an integer (most likely 4 bytes on your platform) instead of an empty string, 1 byte.
asdf.