Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Receiving server info

  1. #11
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts

    send 'getstatus' PHP

    Quote Originally Posted by maxdamage99 View Post
    PHP Code:
    <?php

    {
    $server_ip '94.142.139.251';
    $server_port '28960';

    $server_info "udp://" $server_ip;
    @
    $connectpacket fsockopen($server_info$server_port$re$errstr2);
    if(!
    $connectpacket

    die(
    'Нету подключения к серверу/Или сервер не существует!'); //server die, offline
    }
    global 
    $server_ip$server_port;
    $sendpacket '\xff\xff\xff\xffgetstatus';
    fwrite($connectpacket$sendpacket);
    socket_set_timeout($connectpacket2);
    $otvet fread($connectpacket15000);
    if(
    $otvet=='яяяяdisconnect') { die('не удалось подключение, или данные не получены!?'); } //dont results
    echo $otvet;
    sleep(1);
    }

    ?>
    It does not display the result.
    server exists.
    Sry, in the required subject, no one reads :с

  2. #12
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    This is the code i made a long time ago.
    PHP Code:
    $errno $errstr null;
    $cmd "\xFF\xFF\xFF\xFFgetstatus";
    $f fsockopen('udp://' $ip$port$errno$errstr$timeout);
    if (!
    $f)
        die (
    "Unable to connect. Error $errno - $errstr\n");
    socket_set_timeout ($f10);
    fwrite ($f$cmd);
    $data '';
    while (
    $d fread ($f10000)) {
        
    $data .= $d;
    }
    fclose ($f); 
    http://php.net/manual/en/function.fread.php
    Last edited by Mitch; 5th May 2015 at 21:06.

  3. The Following 2 Users Say Thank You to Mitch For This Useful Post:

    kung foo man (6th May 2015),maxdamage99 (6th May 2015)

  4. #13
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    LLLLOOOOOOLLLL!!!!!
    PHP Code:
    $sendpacket '........'//dont true
    /////
    $sendpacket "......."//TRUEEE 
    thx, Mitch :з

  5. The Following User Says Thank You to maxdamage99 For This Useful Post:

    Mitch (6th May 2015)

  6. #14
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Error:
    PHP Code:
    Parse errorsyntax errorunexpected T_STRING in Z:\xxx\xxx\xxxx\xxxx\xxxxxx.php on line 13 
    help me!)
    PHP Code:
    {
    $linesinfo explode("\", $infooservere);
    {    
          echo "
    &#1052;аксимальное количество игроков: " . $linesinfo[1];
    }
         

    I think that the error in the function explode(); because delimetr "\".

  7. #15
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    " needs to be escaped, hence you need to write "\"", or '"' might work also (with ').
    timescale 0.01

  8. The Following User Says Thank You to kung foo man For This Useful Post:

    maxdamage99 (6th May 2015)

  9. #16
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    I solved this problem, and now I need to get information on the current number of players on the server ?? What cmd i can do it?
    info maxclients: sv_maxclients.
    info map: mapname.
    info name server: sv_hostname.
    info сurrently, the number of players on the server: ?????

  10. #17
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts

    status server, current player

    Quote Originally Posted by maxdamage99 View Post
    I solved this problem, and now I need to get information on the current number of players on the server ?? What cmd i can do it?
    info maxclients: sv_maxclients. (30)
    info map: mapname.
    info name server: sv_hostname.
    info сurrent player: ????? (5/30)
    sry bad english.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •