Forum

Results 1 to 3 of 3
  1. #1
    Join Date
    September 2015
    Location
    Germany
    Posts
    24

    Clients from Groups in PHP

    hi all,

    i installed a php script for creating a banner with teamspeak information.
    That script use the ts3admin.class.php.

    In that php script are variables like "virtualserver_maxclients".
    Full script lools like this:
    <?php
    //-> Copyright © 2016 by Canna
    //-> 4.3.2017 Changes by Lars "elyday" <[email protected]>
    //-> Version: 0.9.7

    include('lib/ts3admin.class.php');
    include('config.inc.php');
    header('Content-Type:image/png');
    date_default_timezone_set('Europe/Berlin');;

    $date = date('d.F Y');
    $time = date('H:i') . " Uhr";
    $slots = 0;
    $maxSlots = 0;

    function tsconnect()
    {
    global $ts3config;
    $ts3 = new ts3admin($ts3config['ts3host'], $ts3config['ts3qport']);
    $connecting = $ts3->connect();
    if ($connecting['success']) {
    $select = $ts3->selectServer($ts3config['ts3port'], true);
    if ($select['success']) {
    if ($ts3config['ts3user'] != "" && $ts3config['ts3pass']) {
    $logging = $ts3->login($ts3config['ts3user'], $ts3config['ts3pass']);
    if ($logging)
    return $ts3;
    else
    return '<p>Die Login Daten funktionieren nicht!</p>';
    } else
    return '<p> Fehler in der config.inc.php. Bitte überprüfe diese und stelle sicher, dass alle Daten vorhanden sind!</p>';
    } else
    return '<p>Der TS3 Port ist fehlerhaft!</p>';
    } else
    return '<p>Es ist ein unerwarteter Fehler aufgetreten. </p>';
    }

    $ts3 = tsconnect();
    $sinfo = $ts3->serverInfo();
    if ($sinfo['success']) {
    $sinfo = $sinfo['data'];
    $slots = $sinfo['virtualserver_clientsonline'] - $sinfo['virtualserver_queryclientsonline'];
    $maxSlots = $sinfo['virtualserver_maxclients'];
    $query = $sinfo['virtualserver_queryclientsonline'] - 1;
    $text = $time . " | " . $date . " | User: " . $slots . "(+" . $query . ") / " . $maxSlots;
    $textTime = $time;
    $textDate = $date;
    $textClients = $slots . "/" . $maxSlots;
    $image = imagecreatefrompng('img/tsbanner.png');
    //$textColor = imagecolorallocate($image, 79, 95, 5);
    $textColor = imagecolorallocate($image, 123, 192, 22);
    //imagestring($image, 5, 10, 5, $text, $textColor);
    //imagettftext($image, 18, 0, 5, 225, $textColor, "fonts/Exo-Medium.ttf", $text);
    imagettftext($image, 20, 0, 60, 200, $textColor, "fonts/Exo-Medium.ttf", $textTime);
    imagettftext($image, 20, 0, 60, 240, $textColor, "fonts/Exo-Medium.ttf", $textDate);
    imagettftext($image, 20, 0, 60, 280, $textColor, "fonts/Exo-Medium.ttf", $textClients);
    imagejpeg($image);
    } else {
    echo $ts3;
    }
    ?>
    How can i add a function to add there a text that shows how many members of 4 specified groups are online?

    I hope anyone can help me.
    And sorry for my bad englisch. Im german and my englisch is not so good ;D

    Regards,
    Timo | NiceKype

  2. #2
    Join Date
    September 2015
    Location
    Germany
    Posts
    24
    have nobody a answer?

  3. #3
    Join Date
    September 2016
    Posts
    47
    You should use foreach with serverGroupClientList() function.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Resolved] Get all clients from all server groups
    By Birman in forum Client Plugins / Lua Scripts
    Replies: 11
    Last Post: December 1st, 2014, 06:54 PM
  2. Getting Server Groups of Clients
    By Dione in forum Client Plugins / Lua Scripts
    Replies: 2
    Last Post: July 28th, 2014, 09:52 PM
  3. Replies: 7
    Last Post: April 17th, 2012, 07:07 PM
  4. Are you sure? When removing clients from groups ;-)
    By jashan in forum Suggestions and Feedback
    Replies: 5
    Last Post: January 9th, 2010, 11:56 PM
  5. Replies: 6
    Last Post: January 8th, 2010, 08:53 PM

Posting Permissions

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