planetteamspeak / ts3phpframework

Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
https://www.planetteamspeak.com
GNU General Public License v3.0
211 stars 59 forks source link

Can't set needed Talk Power of certain channel #97

Closed muleyo closed 6 years ago

muleyo commented 6 years ago

Hello,

I can't set the needed Talk Power of a certain channel.

Here's my code:

<?php
    // Initialing the Framework
    require_once("libraries/TeamSpeak3/TeamSpeak3.php");

    // TS3 ServerQuery URL Credentials
    $username = 'serveradmin';
    $password = 'testing1234';
    $ip = '127.0.0.1';
    $port ='9987';

    // TS3 ServerQuery URL
    $ts3_url = "serverquery://$username:$password@$ip:10011/?server_port=$port";

    // Creating object of the Framework
    $ts3_framework = new TeamSpeak3();

    // Setting Channel + Permission ID + Permission Value
    $cid = 301;
    $permid = 120; // Get the IDs from here: https://yat.qa/resources/permission-ids/
    $permvalue = 100;

    // Logging into TS3Server
    $ts3_server = $ts3_framework->factory($ts3_url);

    // Parent
    $ts3 = $ts3_server->getParent();

    // Setting Talk Power of channel
    $ts3_server->channelGetById($cid)->permAssign($permid, $permvalue);

    // List ServerID + Servername
    $id = $ts3_server->getId();
    $name = $ts3_server->channelGetById($cid)->getParent();
    echo "Server ID: ". $id ."<br />";
    echo "Server Name: ". $name ."<br />";
?>
muleyo commented 6 years ago

Got it working, the permission ID was incorrect. Totally my bad x)