title: How to fix this Server Query for samp?
body: <p>I'm trying to implement Query Mechanism in Samp. I writed code, but it does not working properly. I was trying to get all information from packet 'i'.
  I was using this website to got some informations about my 
  problem. Unfortunately I do not understand it enough.
  <strong><a href="https://wiki.sa-mp.com/wiki/Query/Request#Recieving_the_packets" rel="nofollow noreferrer">https://wiki.sa-mp.com/wiki/Query/Request#Recieving_the_packets</a></strong></p>
  
  <p>Main problem its that, I can't get more players than 126 from the maxplayers.
  I realized that is the max index of ASCII printable
  characters.</p>
  
  <pre class="lang-pascal prettyprint-override"><code>unit Unit6;
  
  interface
  
  uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdBaseComponent,
    IdComponent, IdUDPBase, IdUDPClient, IdIPWatch;
  
  type
    TForm6 = class(TForm)
      StrList: TMemo;
      UDPClient: TIdUDPClient;
      Button1: TButton;
      IdIPWatch1: TIdIPWatch;
      hostname: TLabel;
      Label1: TLabel;
      Label2: TLabel;
      Label3: TLabel;
      procedure Button1Click(Sender: TObject);
    private
      { Private declarations }
    public
      { Public declarations }
    end;
  
  var
    Form6: TForm6;
  
  const
  ip: string = '109.230.228.151';
  port: integer = 7777;
  
  implementation
  
  {$R *.dfm}
  
  procedure TForm6.Button1Click(Sender: TObject);
  var
  Players,MaxPlayers,receivedstring,kopreceivedstring,kopreceivedstring2,Buffer:string;
  stringlen,stringlenfromtext:integer;
  begin
    StrList.Lines.Text:= ip;
    StrList.Lines.Text:=StringReplace(StrList.Lines.Text, '.', #13, [rfReplaceAll]);
    Buffer := 'SAMP' + Chr(StrToIntDef(StrList.Lines[0], 100)) + Chr(StrToIntDef(StrList.Lines[1], 100)) + Chr(StrToIntDef(StrList.Lines[2], 100)) + Chr(StrToIntDef(StrList.Lines[3], 100));
    Buffer := Buffer + Chr(port and 255) + Chr((port shr 8) and 255)+ 'i';
  
      UDPClient.Host:=IdIPWatch1.LocalIP;
      UDPClient:= TIdUDPClient.Create(self);
      UDPClient.Active := True;
      UDPClient.Send(ip,port,Buffer);
      UDPClient.ReceiveTimeout := 1500;
      receivedstring:=UDPClient.ReceiveString();
        if (receivedstring&lt;&gt;'') then
        begin
        kopreceivedstring:=receivedstring;
        kopreceivedstring2:=kopreceivedstring;
        Delete(receivedstring, 1, 1);
        Delete(kopreceivedstring,1,1);
        Delete(kopreceivedstring2,1,1);
          Players:=receivedstring;
          MaxPlayers:=receivedstring;
        label3.Caption:= inttostr(ord(Players[12]))+' / '+inttostr(ord(MaxPlayers[14]));
        stringlen:= ord(kopreceivedstring[16]);
        Delete(receivedstring, 1, Length(receivedstring[4])+18);
        hostname.Caption:=receivedstring;
          //gamemode
          Delete(kopreceivedstring,1,length(kopreceivedstring[4])+22+stringlen);
           label1.Caption:=kopreceivedstring;
           stringlenfromtext:=label1.GetTextLen;
          //Language
          Delete(kopreceivedstring2,1,length(kopreceivedstring2[4])+25+stringlenfromtext+stringlen);
          label2.Caption:=kopreceivedstring2;
        UDPClient.Active := False;
        UDPClient.Free;
    end;
  end;
  
  end.
  
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Z4Y59.png" rel="nofollow noreferrer">Picture of result!</a></p>
  
  <p>I Try to got players, which correct is <code>0 / 500</code> but i got <code>0 / 65533</code>
  I will be really enjoyed if you guys explain how it works.</p>