Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Page 53 of 100 FirstFirst ... 343515253545563 ... LastLast
Results 781 to 795 of 1498
  1. #781
    Join Date
    June 2012
    Location
    Portugal
    Posts
    317
    Quote Originally Posted by nomis002 View Post
    I needed to repost this due flood control or such. I'm running this script on a website not on my local computer. I'll contact my webhost maybe.
    Ah, probably you need function fsock_open.
    But I don't think that would cause the Time out error, I think it would cause other error.
    Contact your host anyway

  2. #782
    Join Date
    April 2010
    Location
    Ontario Canada
    Posts
    224
    Just wondering how do we get just the viewer to put on our website? example:

    http://i5.photobucket.com/albums/y17...ps1fb8919a.png

    We've been using TSviewer and it doesn't display spacers and just looks horrible on our website http://www.sasklan.com


    Hopefully we can get some help with this and a direction on where to start to add this to our place.

  3. #783
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Since TSViewer.com is also using this framework (outdated version tho) to generate the viewers, I would assume that you can include it the exact same way.

    Just have a look at the example snippets in the documentation.

  4. #784
    Join Date
    November 2012
    Posts
    8
    @ScP I don't understand the function memberof();

    PHP Code:
    $usergrups $ts3_VirtualServer->clientGetByName("$nickname")->memberOf();
    foreach(
    $usergrups as $ts3_Client)
    {
    echo 
    ''.$ts3_Client['client_servergroups'].'</br>';

    so, Is possible to obtain all groups from a client offline? I just want search a user and add or remove groups from him.

    PHP Code:
    $ts3_VirtualServer->clientGetByUid("$uid")->addServerGroup($sgid);
    $ts3_VirtualServer->clientGetByUid("$uid")->remServerGroup($sgid); 
    this works only for Users Online

    Edit: This works for users offline

    PHP Code:
    $idDB $searchuser[0];
    $ts3_VirtualServer->serverGroupClientAdd($sgid,$idDB);
    $ts3_VirtualServer->serverGroupClientDel($sgid,$idDB); 
    PHP Code:
    $searchuser $ts3_VirtualServer->clientFindDb($nickname); 
    For search a User in the DB only works with Nickname, how can I search a user with Unique ID?
    Edit:
    This works
    PHP Code:
    $searchuser $ts3_VirtualServer->clientFindDb($uniqueid$uid=true); 
    next question: how get errors more simples?

    I get this error if I delete a user that does not exist in a group.
    Code:
    Fatal error:  Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'empty result set' in /home/teamspeak/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php:319
    Stack trace:
    #0 /home/teamspeak/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php(91): TeamSpeak3_Adapter_ServerQuery_Reply->fetchError(Object(TeamSpeak3_Helper_String))
    #1 /home/teamspeak/libraries/TeamSpeak3/Adapter/ServerQuery.php(141): TeamSpeak3_Adapter_ServerQuery_Reply->__construct(Array, 'servergroupdelc...', Object(TeamSpeak3_Node_Host), true)
    #2 /home/teamspeak/libraries/TeamSpeak3/Node/Abstract.php(73): TeamSpeak3_Adapter_ServerQuery->request('servergroupdelc...', true)
    #3 /home/teamspeak/libraries/TeamSpeak3/Node/Server.php(90): TeamSpeak3_Node_Abstract->request('servergroupdelc...', true)
    #4 /home/teamspeak/libraries/TeamSpeak3/Node/Abstract. in /home/teamspeak/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php on line 319

    This only my advance, sorry for my bad english.
    Last edited by MrRoboto; December 15th, 2013 at 12:04 PM.

  5. #785
    Join Date
    June 2012
    Location
    Portugal
    Posts
    317
    To get error more simplier you should enclose your pieces of code in try { } catch() { }

    It is a great way to handle errors.

    PHP Code:
    try {
        
    $ts3_VirtualServer->clientGetByUid($uid)->addServerGroup($sgid);
    } catch(
    TeamSpeak3_Exception $e) {
        echo 
    $e->getMessage();
        
    // You can also manipulate by checking codes, $e->getCode()


  6. #786
    Join Date
    April 2010
    Location
    Ontario Canada
    Posts
    224
    Quote Originally Posted by ScP View Post
    Just have a look at the example snippets in the documentation.
    Which documentation do I need to look at to see these snippets?

  7. #787
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Quote Originally Posted by Trunkz Jr View Post
    Which documentation do I need to look at to see these snippets?
    You're kidding, right?

    http://docs.planetteamspeak.com/ts3/...ml#example_sec

  8. #788
    Join Date
    December 2012
    Location
    Paris, France
    Posts
    185
    Hi!

    when i try to send text message this is wont work :/
    Here is my source :
    PHP Code:
    $ts3->execute("sendtextmessage",
        array(
            
    "msg" => "[b][color=blue]This is a test about sending text message to channel from PHP script[/color][/b]",
            
    "target" => $client->cid,
            
    "targetmode" => TeamSpeak3::TEXTMSG_CHANNEL
        
    )
    ); 
    $client->cid is working, i got my channel id but when i leave blank target i haven't got exception

    PHP Code:
    $ts3->execute("sendtextmessage",
        array(
            
    "msg" => "[b][color=blue]This is a test about sending text message to channel from PHP script[/color][/b]",
            
    "target" => '',
            
    "targetmode" => TeamSpeak3::TEXTMSG_CHANNEL
        
    )
    ); 
    I dont understand, for other target type the first code work perfectly

  9. #789
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Quote Originally Posted by Toine View Post
    I dont understand, for other target type the first code work perfectly
    The "problem" is that a client can't send messages to other channels... which means that you need to join the target channel first before sending the message. Here's what I'm doing in the message() method for channel objects:

    http://docs.planetteamspeak.com/ts3/...903c29aee75eb7

    So I'd recommend using this code:

    PHP Code:
    $ts3->channelGetById($cid)->message("Hello World!"); 

  10. #790
    Join Date
    December 2012
    Location
    Paris, France
    Posts
    185
    Nice, this work perfectly!

    I got another, last, problem. I dont find how i can catch the text message send to the virtual server by client.

    I would like build a small bot to execute some command lines from server admin like this:
    <12:59:23> "Toine": !rand
    <12:59:23> "Bot": Toine obtain 73
    This is a small example i want provide administrative function without any login/password or query interface.

  11. #791
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Quote Originally Posted by Toine View Post
    I got another, last, problem. I dont find how i can catch the text message send to the virtual server by client.
    Have a look at this code snippet:

    http://docs.planetteamspeak.com/ts3/...html#example14

  12. #792
    Join Date
    December 2012
    Location
    Paris, France
    Posts
    185
    Quote Originally Posted by ScP View Post

    Thank you, i have read your doc and build a small bot but i have a problem with this bot.

    The clienList() is not refresh when i call many time the same class, how i can force the refresh?

    here is a sample code :

    Source code removed

    Here is the sample test from my TS3 server :
    <10:58:05> "Gecko": !team
    <10:58:05> "D.A.R.Y.L": ClientList: Gecko
    <10:58:13> "Gecko1" connected to channel "[cspacer]Bienvenue"
    <10:58:14> "Gecko1" switched from channel "[cspacer]Bienvenue" to "La taverne du nain brailleur"
    <10:58:14> Channel group "Normal" was assigned to "Gecko1" by " ٩(̾●̮̮̃̾•̃̾)۶ Carnéia & Under control ٩(̾●̮̮̃̾•̃̾)۶".
    <10:58:18> "Gecko": !team
    <10:58:18> "D.A.R.Y.L": ClientList: Gecko
    When player join, he is not included to the clien list, when one user leave i got error 'Invalid ID' Oo

    How i can force the refresh of clientList function and all other functions?

    I got another problem, after a certain time i got fatal error with connexion lost, how i can fix it?

    Thank you for your help
    Last edited by Toine; December 23rd, 2013 at 05:09 PM.

  13. #793
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    I'm caching the list of clients internally, but you can force a refresh by calling clientListReset() first. The timeout issue will probably be fixed then too. The TeamSpeak 3 Server will drop a ServerQuery client after 5 minutes of inactivity so you'll have to send a command randomly to keep aht connection "alive".

  14. #794
    Join Date
    June 2012
    Location
    Portugal
    Posts
    317
    I actually never tried coding a bot in PHP, I have one in Java that is configured by users through the website.
    Is it worth to make a bot that needs to be 24/7 in PHP? Simple stuff, that doesn't need threads.

  15. #795
    Join Date
    December 2013
    Posts
    1

    Question

    Hello guys!
    I have a little problem and I already searched the whole day.
    I want to make a little php script, that shows me the actual clients which are online and the maximum slots from the server.
    My script looks like this:


    <?php
    require_once('libraries/TeamSpeak3/TeamSpeak3.php');
    $server = array(
    "tsip" => "localhost",
    "tsport" => "9987",
    "ts_query_admin" => "serveradmin",
    "ts_query_password" => "*******",
    "ts_query_port" => "10011",
    "ts_query_user_nick" => "Serverclientviewer"
    );
    try {
    TeamSpeak3::init();
    $ts3_VirtualServer = TeamSpeak3::factory("serverquery://".$server["ts_query_admin"].":".$server["ts_query_password"]."@".$server["tsip"].":".$server["ts_query_port"]."/?server_port=".$server["tsport"]."&nickname=".$server["ts_query_user_nick"]."");

    $max = intval(@$out['virtualserver_maxclients']);
    $now = intval(@$out['virtualserver_clientsonline']) - 1; // server count us as a client so -1
    echo "max:{$max} now:{$now}";

    } catch(Exception $e) {
    echo "Fehler!<br/>ErrorID: <b>". $e->getCode() ."</b>; Error Message: <b>". $e->getMessage() ."</b>;";
    }
    ?>




    But the output is always: max:0 now:-1

    The client is connecting (I can see this):
    <17:00:31> "serveradmin from 127.0.0.1:39013" loggte sich in Channel "[cspacer]░▒▓█ Willkommen/Welcome █▓▒░" ein
    <17:00:31> "serveradmin from 127.0.0.1:39013" nennt sich nun "Serverclientviewer"
    <17:00:31> "Serverclientviewer" hat die Verbindung getrennt (disconnecting)

    What is my mistake? I'm a newbie in Php so please conside this^^.
    I'm sorry for my English, I'm from Switzerland.

    Sincerely,
    Noah aka NoXx

    EDIT//:
    I found a better script, so to everybody with the same problem use this script:
    <?php
    /**
    * @name Display TS3 Status and Clientcount
    * @author SilentStorm
    */

    date_default_timezone_set("Europe/London");
    require_once("./libraries/TeamSpeak3/TeamSpeak3.php");
    TeamSpeak3::init();

    header('Content-Type: text/html; charset=utf8');

    $status = "offline";
    $count = 0;
    $max = 0;

    try {
    $ts3 = TeamSpeak3::factory("serverquery://<QUERY_USER>:<PASSWORD>@<SERVER_NAME_OR_IP>:<QUERY _PORT>/?server_port=<TS3_VOICE_PORT>&use_offline_as_virtu al=1&no_query_clients=1");
    $status = $ts3->getProperty("virtualserver_status");
    $count = $ts3->getProperty("virtualserver_clientsonline") - $ts3->getProperty("virtualserver_queryclientsonline") ;
    $max = $ts3->getProperty("virtualserver_maxclients");
    }
    catch (Exception $e) {
    echo '<div style="background-color:red; color:white; display:block; font-weight:bold;">QueryError: ' . $e->getCode() . ' ' . $e->getMessage() . '</div>';
    }
    echo '<span class="ts3status">TS3 Server Status: ' . $status . '</span><br/><span class="ts3_clientcount">Clients online: ' . $count . '/' . $max . '</span>';

    ?>

    Replace the <PARAMETERS_> with your settings. So for example you have to change <QUERY_USER>:<PASSWORD> to serveradminassword

    Greetz

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
  •