AndryGabry
Member
- Dec 16, 2016
- 26
- 9
- 38
how can I set up a server group for all users at the same time?
<?php
include_once('TeamSpeak3/TeamSpeak3.php');
// Connection configuration
$login_name = 'serveradmin'; // query login info
$login_password = '9kg6eRKk'; // =||=
$ip = 'localhost'; // ex. 127.0.0.1/ 254.13.121.12
$query_port = '10011'; // default 10011
$virtualserver_port= '9987'; // virtual server port
$group = '7';
try
{
$ts3 = TeamSpeak3::factory("serverquery://".$login_name.":".$login_password."@".$ip.":".$query_port."/?server_port=".$virtualserver_port."&nickname=R4P3&blocking=0");
// query clientlist from virtual server
$clientList = $ts3->clientList();
foreach ($clientList as $client) {
if($client['client_type'] == 1) continue;
if(!in_array($group, explode(',', $client['client_servergroups']))){
$cldbid = $client->getInfo();
$ts3->serverGroupClientAdd($group,$cldbid['client_database_id']);
}
}
}
catch(Exception $e)
{
echo ($e);
}
?>
foreach ($clientList as $client) {
if($client['client_type'] == 1) continue;
if(!in_array($group, explode(',', $client['client_servergroups']))){
$cldbid = $client->getInfo();
$ts3->[B]serverGroupClientAdd[/B]($group,$cldbid['client_database_id']);
}
foreach ($clientList as $client) {
if($client['client_type'] == 1) continue;
if(!in_array($group, explode(',', $client['client_servergroups']))){
$cldbid = $client->getInfo();
$ts3->[B]serverGroupClientDel[/B]($group,$cldbid['client_database_id']);
}
I didnt check if that is function for revoking user groups, but that should work.$ts3->serverGroupClientDel
And what about that? It just opens a connection in non blocking mode.last thing, things blocking=0 ?
Here you are.
PHP:<?php include_once('TeamSpeak3/TeamSpeak3.php'); // Connection configuration $login_name = 'serveradmin'; // query login info $login_password = '9kg6eRKk'; // =||= $ip = 'localhost'; // ex. 127.0.0.1/ 254.13.121.12 $query_port = '10011'; // default 10011 $virtualserver_port= '9987'; // virtual server port $group = '7'; try { $ts3 = TeamSpeak3::factory("serverquery://".$login_name.":".$login_password."@".$ip.":".$query_port."/?server_port=".$virtualserver_port."&nickname=R4P3&blocking=0"); // query clientlist from virtual server $clientList = $ts3->clientList(); foreach ($clientList as $client) { if($client['client_type'] == 1) continue; if(!in_array($group, explode(',', $client['client_servergroups']))){ $cldbid = $client->getInfo(); $ts3->serverGroupClientAdd($group,$cldbid['client_database_id']); } } } catch(Exception $e) { echo ($e); } ?>
Gist: https://gist.github.com/kallefrombosnia/e69da8485aeac2621ccc3ed9d2228f1e