Forum

Page 86 of 100 FirstFirst ... 3676848586878896 ... LastLast
Results 1,276 to 1,290 of 1496
  1. #1276
    Join Date
    May 2016
    Posts
    1

    How do I update the clientCount()?

    Hello,
    I am using clientCount() multiple times in my script, but when somebody joins the output doesen't change and it isn't up to date anymore.
    How do I fix it? Please help

  2. #1277
    Join Date
    May 2016
    Posts
    1
    I am trying to get all "normal" server groups, meaning to template/query groups included.

    From my understanding this should work fine:
    PHP Code:
    foreach ( $server->serverGroupList( ["type" => TeamSpeak3::GROUP_DBTYPE_REGULAR] ) as $group )
    {
      
    $groups[$group->sgid] = $group->name;

    However it returns template/query groups too, any ideas?

  3. #1278
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Quote Originally Posted by Wackelkontakt View Post
    Hello,
    I am using clientCount() multiple times in my script, but when somebody joins the output doesen't change and it isn't up to date anymore.
    How do I fix it? Please help
    The framework is caching a lot of information. To reset the cache, use these two methods:

    PHP Code:
    $server->resetNodeInfo();
    $server->resetNodeList(); 


    Quote Originally Posted by AhmadE. View Post
    I am trying to get all "normal" server groups, meaning to template/query groups included.

    From my understanding this should work fine:
    PHP Code:
    foreach ( $server->serverGroupList( ["type" => TeamSpeak3::GROUP_DBTYPE_REGULAR] ) as $group )
    {
      
    $groups[$group->sgid] = $group->name
    However it returns template/query groups too, any ideas?
    Try this:

    PHP Code:
    foreach($server->serverGroupList(array("type" => TeamSpeak3::GROUP_DBTYPE_REGULAR)) as $group_id => $group)
    {
      echo 
    $group " has ID " $group_id "<br />\n";


  4. #1279
    Join Date
    May 2016
    Posts
    1

    How to get CHANNEL ID

    Hey all, I am using the subChannelList() as a function, and now my problem is, in my
    Code:
    foreach($channels as $chan){
    	$current_cid = $virt->$chan->whoamiGet("cid");
    	$chan = $ts3->clientGetByDbid(2)->setChannelGroup($current_cid,8);
    }
    I need to somehow get something like this working?

    To explain more, I need the function to go setChannelGroup to specific cldbid in every single channel, lets say for example, I want to set a client to channel group guest in all sub channels of a channel (because the client didn't inherit channel group from parent channel, or the client did, but then he created a channel and got the default channel admin group.

    Is there any suggestions for a better way to implement something like this with PHP ?

    All the best
    Rufus

  5. #1280
    Join Date
    June 2016
    Posts
    2
    My code:
    Code:
     <?php
    
    /* load framework library */
    require_once("TeamSpeak3/TeamSpeak3.php");
    
    /* initialize */
    TeamSpeak3::init();
    
    try
    {
      /* subscribe to various events */
      TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryConnected", "onConnect");
      TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryWaitTimeout", "onTimeout");
      TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyLogin", "onLogin");
      TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyEvent", "onEvent");
      TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServerselected", "onSelect");
    
      /* connect to server, login and get TeamSpeak3_Node_Host object by URI */
      $ts3 = TeamSpeak3::factory("serverquery://login:[email protected]:10011/?server_port=9987&blocking=0");
    	$ts3->request('clientupdate client_nickname=login');
    	
      /* wait for events */
      while(1) $ts3->getAdapter()->wait();
    }
    catch(Exception $e)
    {
      die("[ERROR]  " . $e->getMessage() . "\n");
    }
    
    // ================= [ BEGIN OF CALLBACK FUNCTION DEFINITIONS ] =================
    
    /**
     * Callback method for 'serverqueryConnected' signals.
     *
     * @param  TeamSpeak3_Adapter_ServerQuery $adapter
     * @return void
     */
    function onConnect(TeamSpeak3_Adapter_ServerQuery $adapter)
    {
      echo "[SIG]\tconnected to TeamSpeak 3 Server on " . $adapter->getHost() . "\n";
    
      echo "[INFO]\tserver is running with version " . $adapter->getHost()->version("version") . " on " . $adapter->getHost()->version("platform") . "\n";
    }
    
    /**
     * Callback method for 'serverqueryWaitTimeout' signals.
     *
     * @param  integer $seconds
     * @return void
     */
    function onTimeout($seconds, TeamSpeak3_Adapter_ServerQuery $adapter)
    {
      echo "[SIG]\tno reply from the server for " . $seconds . " seconds\n";
    
      if($adapter->getQueryLastTimestamp() < time()-300)
      {
        echo "[INFO]\tsending keep-alive command\n";
    
        $adapter->request("clientupdate");
      }
    }
    
    /**
     * Callback method for 'notifyLogin' signals.
     *
     * @param  TeamSpeak3_Node_Host $host
     * @return void
     */
    function onLogin(TeamSpeak3_Node_Host $host)
    {
      echo "[SIG]\tauthenticated as user " . $host->whoamiGet("client_login_name") . "\n";
    }
    
    /**
     * Callback method for 'notifyEvent' signals.
     *
     * @param  TeamSpeak3_Adapter_ServerQuery_Event $event
     * @param  TeamSpeak3_Node_Host $host
     * @return void
     */
    function onEvent(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host)
    {
      echo "[SIG]\treceived notification " . $event->getType() . "\n\t" . $event->getMessage() . "\n";
    }
    
    /**
     * Callback method for 'notifyServerselected' signals.
     *
     * @param  string $cmd
     * @return void
     */
    function onSelect(TeamSpeak3_Node_Host $host)
    {
      echo "[SIG]\tselected virtual server with ID " . $host->serverSelectedId() . "\n";
      
      $host->serverGetSelected()->notifyRegister("server");
      $host->serverGetSelected()->notifyRegister("channel");
      $host->serverGetSelected()->notifyRegister("textserver");
      $host->serverGetSelected()->notifyRegister("textchannel");
      $host->serverGetSelected()->notifyRegister("textprivate");
    }
    And i received:
    Code:
    [SIG]   received notification clientmoved
            ctid=38 reasonid=0 clid=16
    [SIG]   received notification clientmoved
            ctid=38 reasonid=0 clid=16
    
    [SIG]   received notification clientleftview
            cfid=41 ctid=0 reasonid=8 reasonmsg=opuszczanie clid=16
    [SIG]   received notification clientleftview
            cfid=41 ctid=0 reasonid=8 reasonmsg=opuszczanie clid=16
    How to fix it?

  6. #1281
    Join Date
    June 2016
    Posts
    1

    Online admins, staffs name and status display as channel description

    Im want to display on the channel description the online admins, staffs, and there channel, where are they and online or afk (toogled away status or not).

    So i mean, i want to see in list, like this:

    xy Admin online Channel: yx
    jake Owner away Channel: AFK
    john Staff online Channel: csgo

    And i want this with run as cronjob, every minute or half minute.

  7. #1282
    Join Date
    May 2016
    Posts
    2
    Quote Originally Posted by ScP View Post
    Yes, that is possible, but you'd have to create your own viewer implementation using the TeamSpeak3_Viewer_Interface interface. You can start by copying the existing HTML viewer class and modify it to suit your needs.
    Hey,

    Any chance you might be able to give me an example or something to get my started on this? Ideally I would like to set the channel IDs that are ignored and not displayed if possible?

  8. #1283
    Join Date
    December 2010
    Posts
    31

    modify() issue

    When calling modify() on a client (TeamSpeak3_Node_Client), the framework resets the nodeInfo. Since the offset no longer exists, fetchNodeInfo() is then called, however fetchNodeInfo() calls $this["client_type"] to check if the type is equal to 1. Since that offset also doesn't exist, it tries to call fetch info again, this causing infinite recursion.

    Example code to reproduce:
    PHP Code:
    $client->modify(['client_description' => $description]);
    $currentGroups $client['client_servergroups']; 
    To fix this issue, I would assume offsetExists() needs to be called on line 365 of Client.php (framework version 1.1.23) before the comparison is made, or alternatively, the client_type is stored as its own class property outside of the nodeInfo property.

  9. #1284
    Join Date
    November 2015
    Posts
    6

    List all clients (even offline) or search for one with partial name

    Hey @ScP I've got a question for you :

    I'm trying to find a user given his name (might be partial name). Since your code only accept strict name I tried to do this (based on your code)

    PHP Code:
    foreach($ts3->clientList() as $client){
        if(
    strpos($client["client_nickname"],'PartialName') !== false$result $client;

    But since it's using clientList() it only returns online clients. And I would like to find offline clients as well.

    How can I achieve that ? I've looked into dbclientlist but it's only displaying 25 clients so I'm not able to iterate trough them to find the one I'm looking for.

  10. #1285
    Join Date
    April 2014
    Posts
    37
    Quote Originally Posted by naurel View Post
    Hey @ScP I've got a question for you :

    I'm trying to find a user given his name (might be partial name). Since your code only accept strict name I tried to do this (based on your code)

    PHP Code:
    foreach($ts3->clientList() as $client){
        if(
    strpos($client["client_nickname"],'PartialName') !== false$result $client;

    But since it's using clientList() it only returns online clients. And I would like to find offline clients as well.

    How can I achieve that ? I've looked into dbclientlist but it's only displaying 25 clients so I'm not able to iterate trough them to find the one I'm looking for.
    You might want to try this function instead -> https://docs.planetteamspeak.com/ts3...5c8a56196f2eef

    documented in here aswell
    http://media.teamspeak.com/ts3_liter...y%20Manual.pdf

  11. #1286
    Join Date
    November 2015
    Posts
    6
    Quote Originally Posted by Multivit4min View Post
    You might want to try this function instead -> https://docs.planetteamspeak.com/ts3...5c8a56196f2eef

    documented in here aswell
    http://media.teamspeak.com/ts3_liter...y%20Manual.pdf
    It's only looking for online user. I want to check on TS's database for offline member too !

    And it's quite short in term of information :

    HTML Code:
    Array
    (
        [24] => Array
            (
                [clid] => 24
                [client_nickname] => TeamSpeak3_Helper_String Object
                    (
                        [string:protected] => Naurel
                        [position:protected] => 0
                    )
    
            )
    
    )
    Last edited by naurel; June 7th, 2016 at 10:02 AM.

  12. #1287
    Join Date
    September 2012
    Posts
    6,078
    scroll down a bit and you'll find clientFindDb
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  13. #1288
    Join Date
    November 2015
    Posts
    6
    Don't know why I didn't see it.

    Is there a way to look for partial name ?

  14. #1289
    Join Date
    September 2012
    Posts
    6,078
    Wildcards are % for an arbitrary string and _ for any single character.
    At least in the underlying command of our query interface. Not sure if and how this has been translated into this Framework.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  15. #1290
    Join Date
    November 2015
    Posts
    6
    Quote Originally Posted by Chris View Post
    Wildcards are % for an arbitrary string and _ for any single character.
    At least in the underlying command of our query interface. Not sure if and how this has been translated into this Framework.
    The % works perfectly. Thank you !

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. PHP Framework
    By Multivit4min in forum Permission System
    Replies: 1
    Last Post: June 29th, 2015, 11:28 AM
  2. PHP Framework
    By phil998 in forum Server Support
    Replies: 0
    Last Post: February 25th, 2015, 06:27 PM
  3. TS3 PHP Framework Visualizations
    By Ronin Design in forum Tools / Web Based
    Replies: 2
    Last Post: February 22nd, 2015, 05:04 AM
  4. Extraction using the Framework
    By HarryMW in forum Tools / Web Based
    Replies: 1
    Last Post: August 3rd, 2012, 07:04 PM
  5. Teamspeak, PHP Framework?
    By mario2027 in forum General Questions
    Replies: 1
    Last Post: December 21st, 2010, 09:30 AM

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
  •