Hello,
I have a problem with GameServer Query A2S_PLAYER query,
If there are like 6 people in server, then the code only ready 3, but if i look the data what is recived, then i can see all 6, can anybody help me with that?
I have searched and played with the code many days already but can't get it work correctly.
Thank you.
SourceQuery ret = new SourceQuery();
int i =0;
var Players = new ListView();
ret.Response = Encoding.Default.GetString(resp);
//if (Type == 0x6D)
//{
ret.Magic = BitConverter.ToInt32(resp, 0);
i += sizeof(Int32);
ret.Type = resp[i++];
ret.NumPlayers = resp[i++];
int NumPlayers = ret.NumPlayers;
int pNR = 0;
i = 6;
while (pNR < NumPlayers && i < resp.Length)
{
var PlayerItem = new ListViewItem();
PlayerItem.Name = "Player";
PlayerItem.Text = GetString(resp, ++i, resp.Length);
i += PlayerItem.Text.Length + 1;
var Score = new System.Windows.Forms.ListViewItem.ListViewSubItem();
Score.Name = "Score";
Score.Text = BitConverter.ToInt32(resp, i).ToString();
i += 4;
PlayerItem.SubItems.Add(Score);
var PlayTime = new System.Windows.Forms.ListViewItem.ListViewSubItem();
PlayTime.Name = "Time";
PlayTime.Text = new TimeSpan(0, 0, (int)BitConverter.ToSingle(resp, i)).ToString();
i += 4;
PlayerItem.SubItems.Add(PlayTime);
pNR++;
Players.Items.Add(PlayerItem);
}
|