Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't read data

Status
Not open for further replies.

DarkMercenary44

Technical User
May 19, 2000
55
US
All right I am writing software to ping my favorite counterstrike game servers, i figured out the commands on how to do it using UDP Protocol, I ping it with the command players and this is what it gives me...

ÿÿÿÿDDrobe  äá‡D{DED}HolyHandGrenade  dÁDScroTor  2Eblistering dëFterror` z B-=[SaK]=-Sanosuke*  =ØÚBNeoApoC  2˜6F-RoE-zempf =ø†B -RoE-WayBaked^3  <µC
lyle simplewitze ó`ÔA =[OC]=anfpunk ®íC -=[SaK]=-Dreadmann =¨åB
-={RPG}=- Scagnetti äXöD=[OC]=Cheetah  dgÐD-RoE-*Stealth* =XÖBExodus = ½BBig Blackie-viE-  ECCombat Kirby d›¼D=[OC]=Astrochimp  œCRastaman 䳪D

Those are the players names that are on the server, also that gibberish behind it is supposed to be numbers of frags, I figured out how to do this by looking at a C++ source file that did the same thing, but I can't figure out how they deciphered that gibberish into numbers, and Ideas??????

DarkMercenary
darkmercenary44@earthlink.net

In the real world
As in dreams
Nothing is quite
What it seems
:Book of Counted Sorrows
 
You have to build a structure in Visual BASIC to deserialize the data.

Something like:

Private Type CSPlayer
Frags As Long
Ping As Integer
Score As Long
Name As String * 25
End Type

Then you have to figure out how many bytes each record takes. You create another structre that has a string that is as big (same size) as the one above.

Private Type Buffer
PlayerInfo As String * 35
End Type

I got 35 by adding the bytes that a Long takes up and the bytes and Integer takes up plus the length of the fixed length string.

Long = 4
Int = 2
String = 1 * 25 = 25

So 4 + 2 + 4 + 25 = 35.

Of course your structure will look a little different since you know what's where in the structure.

Anyway, just use the mid$() function to pick on each player.

So if there are 10 people on a server and you want all their information do this:

Dim strBuffer As String
Dim udtPlayer As CSPlayer
Dim udtBuffer As Buffer
Dim intPlayer As Integer

For intPlayer = 1 To Len(strBuffer) / Len(udtPlayer)
udtBuffer = mid$(strBuffer, intPlayer * Len(udtPlayer, Len(udtPlayer))
LSet udtPlayer = udtBuffer

'Now just access the member variables.
With udtPlayer
Debug.Print .Name
Debug.Print .Ping
Debug.Print .Score
Debug.Print .Frags
End With
Next intPlayer

Good Luck! Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Opps... the line that says:

udtBuffer = mid$(strBuffer, intPlayer * Len(udtPlayer, Len(udtPlayer))

Should Read:

udtBuffer.PlayerInfo = mid$(strBuffer, intPlayer * Len(udtPlayer, Len(udtPlayer)) Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Opps... the line that says:

udtBuffer = mid$(strBuffer, intPlayer * Len(udtPlayer, Len(udtPlayer))

Should Read:

udtBuffer.PlayerInfo = mid$(strBuffer, intPlayer * Len(udtPlayer, Len(udtPlayer))) Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Opps... the line that says:

udtBuffer = mid$(strBuffer, intPlayer * Len(udtPlayer, Len(udtPlayer))

Should Read:

udtBuffer.PlayerInfo = mid$(strBuffer, intPlayer * Len(udtPlayer), Len(udtPlayer)) Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Snaggs , your a genuis DarkMercenary
darkmercenary44@earthlink.net

In the real world
As in dreams
Nothing is quite
What it seems
:Book of Counted Sorrows
 
DarkMercenary,

Did you ever get this to work? Just curious...
Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
I did somewhat, but I'm still trying to figure out what order is what in the return string, I've somewhat made sense out of the code. Just have to get the right order and byte length. DarkMercenary
darkmercenary44@earthlink.net

In the real world
As in dreams
Nothing is quite
What it seems
:Book of Counted Sorrows
 
If you have the C++ Source code for it, there might be a structure of it already defined. It's probably in a header file (a .h file). Once you find the structure, you'll be able to recreate it in Visual BASIC.

Also, if the code takes an object oriented approach, figure out where they are assigning the Frags and Ping properties from and work backwards from there. You'll find it eventually.

Cheers, Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Thanks for the tip, and yes I do have a C++ source from that Q3DPlug for webpages, it does counterstrike servers also, thats what I'm looking at, but I don't know a lick of C++, do know a very very small ammount of C, just variable decs, and structs so that sohould help me out a little.. DarkMercenary
darkmercenary44@earthlink.net

In the real world
As in dreams
Nothing is quite
What it seems
:Book of Counted Sorrows
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top