Results 1 to 8 of 8

Thread: Mini question

  1. #1
    Player Zorono's Avatar
    Join Date
    Feb 2017
    Location
    GetPlayerPos(Zorono, Float:xCord, Float:yCord, Float:zCord);
    Posts
    5
    Rep Power
    0

    Mini question

    hey all, iam stuck at a big proplem and its how to check if my server is online or n't with SACNR Monitor PHP API please guys help

    - - - Updated - - -

    Bumb ??? please i need help guys


  2. #2
    SACNR Admin Jamie's Avatar
    Join Date
    Jun 2012
    Posts
    882
    Rep Power
    1
    You just want to see if it's online or offline?

    Would this work?

    PHP Code:
    <?php
    require_once("monitor.php");
    $monitor = new SACNR\Monitor;
    $res $monitor->get_info_by_ip('IP''Port');

    if (
    is_null($res)) {
        echo 
    'Offline';
    } else {
        echo 
    'Online';
    }
    it's always gee's fault

  3. #3
    Player Zorono's Avatar
    Join Date
    Feb 2017
    Location
    GetPlayerPos(Zorono, Float:xCord, Float:yCord, Float:zCord);
    Posts
    5
    Rep Power
    0
    please what is the right way to import the server information hostname/gamemodename/mapname.... please ???


  4. #4
    SACNR Admin Jamie's Avatar
    Join Date
    Jun 2012
    Posts
    882
    Rep Power
    1
    Should all be stored within $res.

    {
    public $ServerID =>
    string(5) "53484"
    public $IP =>
    string(14) "137.74.179.193"
    public $Port =>
    string(4) "7777"
    public $Hostname =>
    string(36) "San Andreas Cops And Robbers (SACNR)"
    public $Gamemode =>
    string(16) "Cops And Robbers"
    public $Language =>
    string(0) ""
    public $Map =>
    string(11) "San Andreas"
    public $MaxPlayers =>
    string(3) "450"
    public $Players =>
    string(1) "6"
    public $Version =>
    string(8) "0.3.7-R2"
    public $Password =>
    string(1) "0"
    public $Time =>
    string(20) "Sunday 09:46, Week 2"
    public $WebURL =>
    string(13) "www.sacnr.com"
    public $Rank =>
    string(3) "330"
    public $AvgPlayers =>
    string(5) "17.51"
    public $HostedTab =>
    string(1) "1"
    public $LastUpdate =>
    string(10) "1486602794"
    public $TotalServers =>
    string(4) "1329"
    }

    so...

    PHP Code:
    echo $res->Hostname
    would return
    San Andreas Cops And Robbers (SACNR)
    Last edited by Jamie; 09-02-2017 at 12:23 AM.
    it's always gee's fault

  5. #5
    Player Zorono's Avatar
    Join Date
    Feb 2017
    Location
    GetPlayerPos(Zorono, Float:xCord, Float:yCord, Float:zCord);
    Posts
    5
    Rep Power
    0
    please how to check if the server has no players online and please what is the right way to import the online players info playerid/playername/score.... please ???
    note: iam converting my my website from another api so iam asking too many questions please help me to convert my websiteas fast as possible please sir


  6. #6
    SACNR Admin Jamie's Avatar
    Join Date
    Jun 2012
    Posts
    882
    Rep Power
    1
    I think it would probably easier if you took some time to learn how to use PHP and echo object properties first.

    You can also find all of the public function calls on this page: http://monitor.sacnr.com/api.html
    it's always gee's fault

  7. #7
    Player Zorono's Avatar
    Join Date
    Feb 2017
    Location
    GetPlayerPos(Zorono, Float:xCord, Float:yCord, Float:zCord);
    Posts
    5
    Rep Power
    0
    Quote Originally Posted by Jamie View Post
    I think it would probably easier if you took some time to learn how to use PHP and echo object properties first.

    You can also find all of the public function calls on this page: http://monitor.sacnr.com/api.html
    dude, this is my first time with this tool and i thought it was using diffrent properties so iam asking you........


  8. #8
    SACNR Admin Jamie's Avatar
    Join Date
    Jun 2012
    Posts
    882
    Rep Power
    1
    Just var_dump the values for each of the public functions:

    PHP Code:
    get_info_by_id(int $server_id)
    get_players_by_id(int $server_id)
    get_query_by_id(int $server_id)
    get_ad_by_id(int $server_id)
    get_info_by_ip(string $ipint $port)
    get_players_by_ip(string $ipint $port)
    get_query_by_ip(string $ipint $port)
    get_ad_by_ip(string $ipint $port
    You'll probably be looking at get_players_by_ip() and get_query_by_ip().
    it's always gee's fault

Posting Permissions

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