For some reason.. it will only let me send a 4 letter length tag, not 2 or 3. Here is my code:
Private Sub cmdInvite_Click()
Dim I As Integer
With PBuffer
.InsertDWORD 0
.InsertNTString txtClanName.Text
Select Case Len(txtTag.Text)
Case 2
.InsertNonNTString vbNullChar & vbNullChar & StrReverse(txtTag.Text)
Case 3
.InsertNonNTString vbNullChar & StrReverse(txtTag.Text)
Case 4
.InsertNonNTString StrReverse(txtTag.Text)
End Select
.InsertBYTE lstMembers.ListItems.Count
For I = 1 To lstMembers.ListItems.Count
.InsertNonNTString lstMembers.ListItems.Item(I).Text & vbNullChar
Next I
.sendPacket &H71
End With
End Sub
Here's packetlog:
Quote
[6:06:30 PM] BNET: Packet sent: 0x71
[6:06:30 PM] Output dump: 0000: 00 00 00 00 54 65 73 74 69 6E 67 00 00 00 56 65 ....Testing...Ve
0010: 09 64 73 66 73 66 64 33 64 00 64 72 73 66 67 66 .dsfsfd3d.drsfgf
0020: 34 00 4D 61 6C 69 63 65 31 31 32 00 73 64 66 73 4.Malice112.sdfs
0030: 64 64 73 33 00 64 73 66 64 73 64 33 00 33 64 73 dds3.dsfdsd3.3ds
0040: 66 64 33 64 00 69 6E 6E 65 72 69 73 74 69 67 68 fd3d.inneristigh
0050: 74 00 69 6E 6E 65 72 6C 69 6B 65 73 6D 65 6E 00 t.innerlikesmen.
0060: 69 6E 6E 65 72 69 73 63 6F 6F 6C 00 inneriscool.....
[6:06:30 PM] BNET: Packet received: 0x71
[6:06:30 PM] Output dump: 0000: FF 71 0A 00 00 00 00 00 02 00 ÿq.............
That's because the clan tag is sent as a DWord, not a string.
Something like this:
.InsertDWORD .GetDWORD(StrReverse(txtTag.Text))
Why don't you TRY it and if it doesn't work then ask us.
I have, and for some reason it works but on the invitation it just says "Clan ". There's no name for it. It still only works for 4 length tag's..
I changed around my code alittle, here's how it is now:
Private Sub cmdInvite_Click()
Dim strCandidates As String, strNew() As String
Dim I As Integer, intCount As Integer
For I = 1 To lstMembers.ListItems.Count
If lstMembers.ListItems.Item(I).Checked Then strCandidates = strCandidates & lstMembers.ListItems.Item(I).Text & vbNullChar
Next I
strNew = Split(strCandidates, vbNullChar)
strCandidates = vbNullString
For I = 0 To 8
strCandidates = strCandidates & strNew(I) & vbNullChar
intCount = intCount + 1
Next I
Erase strNew()
With PBuffer
.InsertDWORD 0
.InsertNTString txtClanName.Text
.InsertDWORD .GetDWORD(StrReverse(txtTag.Text))
.InsertBYTE intCount
.InsertNonNTString strCandidates
.sendPacket &H71
End With
End Sub
Quote.InsertDWORD .GetDWORD(StrReverse(txtTag.Text))
... why are you reversing the clan tag?
Quote.InsertNonNTString strCandidates
The username's are sent as null-terminated strings... why not just replace those few horrible lines of code which is then inserted into the buffer using a function which shouldn't be in it in the first place with:
.InsertSTRING User1
.InsertSTRING User2
.InsertSTRING User3
...
Quote from: LoRd[nK] on March 17, 2005, 04:10 AM
Quote.InsertDWORD .GetDWORD(StrReverse(txtTag.Text))
... why are you reversing the clan tag?
Quote.InsertNonNTString strCandidates
The username's are sent as null-terminated strings... why not just replace those few horrible lines of code which is then inserted into the buffer using a function which shouldn't be in it in the first place with:
.InsertSTRING User1
.InsertSTRING User2
.InsertSTRING User3
...
Because it's easy as a array. And you reverse tha tag because you're supposed to.
Inner, this isnt a flame. But...
You post code thinking people are going to fix it up and paste it back. People will only spot out the errors, and then you will have to find it in your code and fix it to what they said.
[ontopic]
Try not to reverse your clan tag? For instance, if it was "Clan vL", it would be "Clan Lv", right?
[/ontopic]
Edit: Blaze fixed my error in lV. Thanks.
The caps wouldn't flip it would be Lv not Vl, IIRC you can't have a clan channel of two letters.
#1, Clan tangs can be 2-4 chrs.
#2, Eww at what you are doing!
Maby this could work.
Dim ClanTag As String * 4, ClanName As String, Users(8) As String
'// Dim the required vareables, #1, ClanTag is atmost 4 chrs long, so dim it as *4, #2 Clan name can be any length (reasonable), #3, You need 9 users, so dim the array as 8 (0-8 = 9 properties)
ClanTag = InputBox("Please enter your clan tag, 2-4 charectors.")
'// Get the wanted clan tag, Will trunce it if it is more then 4 chrs long, and will padd it with spaces if it is less.
ClanName = InputBox("Please enter your clan name.")
'// Get the Clan Name, Blah.
For X = 0 To 8
'// You need 9 users, 0-8 = 9 units.
Users(X) = InputBox("Please enter user #" & X & "'s username.")
'// Gets all 9 users.
Next X
ClanTag = StrReverse(Replace(ClanTag, Space(1), vbNull))
'// The clan tag is a DWORD, so it is 4 in length, hence the *4 at the dimming, We want to replace the Spaces with null chrs as to make the clan name w/o spaces.
'// Also This is a bad way, but DWORD string (shush peopl) are reserves, Hence RATS not STAR.
.InsertDWORD &H1 '//Cookie
.InsertNTString ClanName '//Clan name
.InsertNonNTString ClanTag '//Clan tag, Dword, but use NonNTString
.InsertBYTE &H9 '//( is the number of peopl you are inviting.
For X = 0 To 8
.InsertNTString Users(X) '// Loop through and get all 9 people.
Next X
.SendPacket &H71 '// Send the dammen thing, we are done!
Change the Input boxes to whatever you need, But Get rid of that nasty way of getting the people.
~-~(HDX)~-~
Hdx, very nice way! But be sure to put some comments in, as he will just prob copy / paste it. :-\
Quote from: Blaze on March 17, 2005, 11:25 AM
The caps wouldn't flip it would be Lv not Vl, IIRC you can't have a clan channel of two letters.
See: Clan BH on USEast
Quote from: inner. on March 17, 2005, 07:03 AM
Because it's easy as a array. And you reverse tha tag because you're supposed to.
The clan tag isn't reversed...
Added comments, I am really bad at that as you can see.
Also waists A LOT of space.
QuoteThe clan tag isn't reversed...
When using it as a dword, the string apears reversed. like RATS insted of STAR.
~-~(HDX)~-~
Quote from: HdxBmx27 on March 17, 2005, 01:45 PM
Added comments, I am really bad at that as you can see.
Also waists A LOT of space.
QuoteThe clan tag isn't reversed...
When using it as a dword, the string apears reversed. like RATS insted of STAR.
~-~(HDX)~-~
('S' << 24 | 'T' << 16 | 'A' << 8 | 'R') String? no. It's 32-bit integer, not string.
You think its bad commenting? That is extremely good. And since i wasnt 100% sure on it first round, and now with comments i understand it.
Good job Hdx! :-*
You are CORRECT. Please dont make this into a bag ass argument, its been descussed to dammen much. The reason I call it a string is that it is the standard charectors fo the americal alphabet. MOST users recongnize that it is readable text. Anyway, YOU ARE CORRECT, it is a 32-bit integer.
Sop off that topic please. As for my commenting, I hate comments :P
~-~(HDX)~-~
Hdx, you think your a bad commenter, but at start i didnt understand some code, but after reading the comments i understand it more.
Hdx, Nice commenting! And dont say you cant, cos u can! :P
hm I told him it was odd for the string to be reversed! bnetdocs is always RIGHT!
Quote from: HdxBmx27 on March 17, 2005, 01:45 PM
Added comments, I am really bad at that as you can see.
Also waists A LOT of space.
QuoteThe clan tag isn't reversed...
When using it as a dword, the string apears reversed. like RATS insted of STAR.
~-~(HDX)~-~
The .GetDWORD() function converts a string into a DWord. You should not reverse the string before calling this function. .InsertNonNTString() has infected you.
Quote from: QwertyMonster on March 17, 2005, 01:13 PM
Hdx, very nice way! But be sure to put some comments in, as he will just prob copy / paste it. :-\
No, I would learn from it first.
Quote from: inner. on March 17, 2005, 05:05 PM
Quote from: QwertyMonster on March 17, 2005, 01:13 PM
Hdx, very nice way! But be sure to put some comments in, as he will just prob copy / paste it. :-\
No, I would learn from it first.
Edit: I tested it and it adds 1 to each blank spot there is in the tag.
Here's my code:
Private Sub cmdInvite_Click()
Dim ClanTag As String * 4, ClanName As String, strCandidates As String, strNew() As String
Dim I As Integer, intCount As Integer
ClanTag = txtTag.Text
ClanName = txtClanName.Text
For I = 1 To lstMembers.ListItems.Count
If lstMembers.ListItems.Item(I).Checked Then strCandidates = strCandidates & lstMembers.ListItems.Item(I).Text & vbNullChar
Next I
strNew = Split(strCandidates, vbNullChar)
strCandidates = vbNullString
For I = 0 To 8
strCandidates = strCandidates & strNew(I) & vbNullChar
intCount = intCount + 1
Next I
Erase strNew()
With PBuffer
.InsertDWORD &H1
.InsertNTString ClanName
.InsertNonNTString StrReverse(Replace(ClanTag, Space(1), vbNull))
.InsertBYTE intCount
.InsertNonNTString strCandidates
.sendPacket &H71
End With
End Sub
Quote from: LoRd[nK] on March 17, 2005, 02:38 PM
The .GetDWORD() function converts a string into a DWord. You should not reverse the string before calling this function. .InsertNonNTString() has infected you.
Yes yes it has, I am trying to work on my coding habbits. But I am failing in a few areas, I am sorry.
~-~(HDX)~-~
Hrm, I cannot get it from adding the 1's when there's a null character in the tag. :(
Quote from: inner. on March 17, 2005, 06:05 PM
Hrm, I cannot get it from adding the 1's when there's a null character in the tag. :(
What? Post some packetlogs of what you are doing, or the contects of vareables after stepping through sertian parts of the code.
~-~(HDX)~-~
Ok.
Quote
[8:20:53 PM] BNET: Packet sent: 0x71
[8:20:53 PM] Output dump: 0000: 00 00 00 00 6F 68 68 69 00 31 31 76 65 09 4D 61 ....ohhi.11ve.Ma
0010: 6C 69 63 65 31 31 32 00 64 73 66 73 66 64 33 64 lice112.dsfsfd3d
0020: 00 73 64 66 73 64 64 73 33 00 64 73 66 64 73 64 .sdfsdds3.dsfdsd
0030: 33 00 33 64 73 66 64 33 64 00 64 72 73 66 67 66 3.3dsfd3d.drsfgf
0040: 34 00 43 50 72 6F 67 72 61 6D 69 6E 67 00 43 70 4.CPrograming.Cp
0050: 72 6F 67 72 61 6D 65 72 00 51 75 65 6C 6F 73 77 rogramer.Quelosw
0060: 79 65 00 ye..............
Didn't LoRd[nK] say to send as DWord?
Quote from: inner. on March 17, 2005, 06:05 PM
Hrm, I cannot get it from adding the 1's when there's a null character in the tag. :(
You are telling it to replace spaces with ones... so why are you asking here...?
If I try to do Chr(0) or anything else, it gives me back some gay response.
Quote
[8:33:45 PM] BNET: Packet received: 0x71
[8:33:45 PM] Output dump: 0000: FF 71 0A 00 00 00 00 00 02 00 ÿq.............
It gives me that directly after I go to create the clan.
When i use:
.InsertDWORD .GetDWORD(Replace(ClanTag, Space(1), Chr(0)))
It works, but on the invitation it just says Clan, no tag.
Here's the packetlog of it:
Quote
[9:09:29 PM] BNET: Packet sent: 0x71
[9:09:29 PM] Output dump: 0000: 00 00 00 00 6F 68 68 69 00 63 65 00 00 09 4D 61 ....ohhi.ec...Ma
0010: 6C 69 63 65 31 31 32 00 64 73 66 73 66 64 33 64 lice112.dsfsfd3d
0020: 00 73 64 66 73 64 64 73 33 00 64 73 66 64 73 64 .sdfsdds3.dsfdsd
0030: 33 00 33 64 73 66 64 33 64 00 43 50 72 6F 67 72 3.3dsfd3d.CProgr
0040: 61 6D 69 6E 67 00 43 70 72 6F 67 72 61 6D 65 72 aming.Cprogramer
0050: 00 51 75 65 6C 6F 73 77 79 65 00 64 72 73 66 67 .Queloswye.drsfg
0060: 66 34 00 f4..............
Any suggestions?
Why are you replacing spaces with nulls? I thought you were supposed to add spaces at the end so it equaled 4 characters.
I also tried that, and it didn't work.
Looks like a valid response to me..
It is, but it's not sending a invitation. It's pissing the living fuck out of me.
Anyone have any suggestions?
I fixed up my code alitte:
Private Function FormatTag(ByVal strTag As String) As String
Select Case Len(strTag)
Case 2
FormatTag = vbNullChar & vbNullChar & StrReverse(strTag)
Case 3
FormatTag = vbNullChar & StrReverse(strTag)
Case 4
FormatTag = StrReverse(strTag)
End Select
End Function
--
Private Sub cmdInvite_click()
Dim ClanName As String, strCandidates As String
Dim I As Integer, intCount As Integer
ClanName = txtClanName.Text
For I = 1 To lstMembers.ListItems.Count
If lstMembers.ListItems.Item(I).Checked Then: s
trCandidates = strCandidates & lstMembers.ListItems.Item(I).Text & Chr$(0)
If lstMembers.ListItems.Item(I).Checked Then: intCount = intCount + 1
Next I
With PBuffer
.InsertDWORD GetTickCount()
.InsertNTString ClanName
.InsertNonNTString FormatTag(txtTag.Text)
.InsertBYTE intCount
.InsertNonNTString strCandidates
.sendPacket &H71
End With
End Sub
Here's the packetlog with it:
Quote
[11:11:40 PM] BNET: Packet sent: 0x71
[11:11:40 PM] Output dump: 0000: F3 37 A7 14 6F 68 68 69 00 00 00 76 65 09 4D 61 ó7§ohhi...ve.Ma
0010: 6C 69 63 65 31 31 32 00 64 73 66 73 66 64 33 64 lice112.dsfsfd3d
0020: 00 73 64 66 73 64 64 73 33 00 64 73 66 64 73 64 .sdfsdds3.dsfdsd
0030: 33 00 33 64 73 66 64 33 64 00 43 50 72 6F 67 72 3.3dsfd3d.CProgr
0040: 61 6D 69 6E 67 00 43 70 72 6F 67 72 61 6D 65 72 aming.Cprogramer
0050: 00 51 75 65 6C 6F 73 77 79 65 00 64 72 73 66 67 .Queloswye.drsfg
0060: 66 34 00 f4..............
[11:11:40 PM] BNET: Packet received: 0x71
[11:11:40 PM] Output dump: 0000: FF 71 0A 00 F3 37 A7 14 02 00 ÿq..ó7§.......
Quote from: inner. on March 17, 2005, 09:34 PM
[11:11:40 PM] BNET: Packet received: 0x71
[11:11:40 PM] Output dump: 0000: FF 71 0A 00 F3 37 A7 14 02 00 ÿq..ó7§.......
Wtf? A deformed response from Bnet?It should be a cookie, (F3 37 A7 14), then the response as a dword. But your reciving the response as a Word. Being the response of 02, it could safily be concived as failure.
~-~(HDX)~-~
That's what happenes when I use 2/3 lengths for tag.
Here's a suggestion: Learn what are and how to use binary datatypes (bytes, words, double-words and strings). Then you'll need to learn how to impliment such datatypes using Visual Basic and finally, you'll need to learn how to use your packetbuffer properly. When you have learned all of these things, sending this packet will be a walk in the park.
I don't know why you go to such lengths to make the tag. Just do something like String(4 - Len(Tag), vbNullChar), and then append or prepend the tag, depending on whatever you're doing with your weird non-DWORD handling of it.
Quote from: Soul Taker on March 18, 2005, 09:27 AM
I don't know why you go to such lengths to make the tag. Just do something like String(4 - Len(Tag), vbNullChar), and then append or prepend the tag, depending on whatever you're doing with your weird non-DWORD handling of it.
I have.
Here's what I tried before using that:
ClanTag = String(4, vbNullChar) & StrReverse(txtTag.Text)
ClanTag = Right$(ClanTag, 4)
Quote from: inner. on March 18, 2005, 03:24 PM
Quote from: Soul Taker on March 18, 2005, 09:27 AM
I don't know why you go to such lengths to make the tag. Just do something like String(4 - Len(Tag), vbNullChar), and then append or prepend the tag, depending on whatever you're doing with your weird non-DWORD handling of it.
I have.
Here's what I tried before using that:
ClanTag = String(4, vbNullChar) & StrReverse(txtTag.Text)
ClanTag = Right$(ClanTag, 4)
Why don't you just use CopyMemory()...?
I'll try it.
Edit:
Private Sub cmdInvite_Click()
Dim ClanTag As String, ClanName As String, strCandidates As String
Dim I As Integer, intCount As Integer
ClanTag = PBuffer.GetDWORD(StrReverse(txtTag.Text))
ClanName = txtClanName.Text
For I = 1 To lstMembers.ListItems.Count
If lstMembers.ListItems.Item(I).Checked Then: strCandidates = strCandidates & lstMembers.ListItems.Item(I).Text & Chr$(0)
If lstMembers.ListItems.Item(I).Checked Then: intCount = intCount + 1
Next I
With PBuffer
.InsertDWORD GetTickCount()
.InsertNTString ClanName
.InsertDWORD StrReverse(ClanTag)
.InsertBYTE intCount
.InsertNonNTString strCandidates
.sendPacket &H71
End With
End Sub
Quote from: inner. on March 18, 2005, 09:50 PM
I'll try it.
Edit:
Private Sub cmdInvite_Click()
Dim ClanTag As String, ClanName As String, strCandidates As String
Dim I As Integer, intCount As Integer
ClanTag = PBuffer.GetDWORD(StrReverse(txtTag.Text))
ClanName = txtClanName.Text
For I = 1 To lstMembers.ListItems.Count
If lstMembers.ListItems.Item(I).Checked Then: strCandidates = strCandidates & lstMembers.ListItems.Item(I).Text & Chr$(0)
If lstMembers.ListItems.Item(I).Checked Then: intCount = intCount + 1
Next I
With PBuffer
.InsertDWORD GetTickCount()
.InsertNTString ClanName
.InsertDWORD StrReverse(ClanTag)
.InsertBYTE intCount
.InsertNonNTString strCandidates
.sendPacket &H71
End With
End Sub
Why did u just post some code? Without saying wether its working or something wrong? What do u want us to do with that code? :-\
Quote from: QwertyMonster on March 19, 2005, 04:34 AM
Why did u just post some code? Without saying wether its working or something wrong? What do u want us to do with that code? :-\
His problem has already been solved, yet he's coming back for more help on nothing. I don't think he should be posting any code
Quote from: UserLoser on March 19, 2005, 12:13 PM
Quote from: QwertyMonster on March 19, 2005, 04:34 AM
Why did u just post some code? Without saying wether its working or something wrong? What do u want us to do with that code? :-\
His problem has already been solved, yet he's coming back for more help on nothing. I don't think he should be posting any code
No, on the invitation it only say's Clan, no name in it.
Then thats and error on your side.
This has been working all along.. My god. I sent it and on the invitation it said "Clan". But I told people to accept it and everyone did and it made the clan I wanted it to. Would anyone know why it only says Clan?
Because your not including the variable that shows the actual clans name on the display message?