<?php
session_start();
require_once 'ts3admin.class.php';
$botname = "FLARECOAPI"; //Website Name
$ts3ip = "127.0.0.1"; //TS3IP
$ts3port = "9987"; //TS3Port
$ts3qport = "10011"; //TS3Query Port
$ts3user = "serveradmin"; //TS3User Login
$ts3pass = ""; //TS3Query Login
$appendrankgroupid = ""; // ID OF THE GROUP YOU WANT TO ADD TO THE IP!
$tsAdmin = new ts3admin($ts3ip, $ts3qport);
if($tsAdmin->getElement('success', $tsAdmin->connect())) {
$tsAdmin->login($ts3user, $ts3pass);
$tsAdmin->setName($botname);
$tsAdmin->selectServer($ts3port);
$clients = $tsAdmin->clientList("-uid -ip -groups -info");
foreach($clients['data'] as $client) {
$cname = $client['client_nickname'];
$ip = $client['connection_client_ip'];
$uid = $client['client_unique_identifier'];
$groups = $client['client_servergroups'];
$version = $client['client_version'];
$platform = $client['client_platform'];
$clid = $client['clid'];
$cid = $client['cid'];
$dbid = $client['client_database_id'];
$time = time();
// IP PART
if($ip == ""){ // INSERT YOUR IP HERE!
$appendrank = $tsAdmin->serverGroupAddClient($appendrankgroupid, $dbid);
}
}
echo "RUN COMPLETED! ".time();
exit;
} else {
die("CONNECTION FAILED");
}
?>
Did you add the "ts3admin.class.php" lib file? It's common for users to forget adding the libsThanks buddy!
EDIT: seems like its not working :/
Yep, i've done that!Did you add the "ts3admin.class.php" lib file? It's common for users to forget adding the libs
I used an older version of ts3admin class.
you can get my class file here:
https://files.flareco.net/a/ts3admin.class.php.txt
*You need to rename the file to ts3admin.class.php after downloading
Yep, i've done that!
I've used the original, last one from the official website, because i use that script on a TeaSpeak Server
EDIT: hm, your's also not working
<?php
require_once('TeamSpeak3/TeamSpeak3.php');
$ts3_host = "localhost";
$ts3_q_port = "10011";
$ts3_s_port = "9987";
$ts3_username = "serveradmin";
$ts3_password = "9kg6eRKk";
$ts3_nick = "R4P3.net";
$selectedOnes = array('127.0.0.1');
$group = '7';
$ts3 = TeamSpeak3::factory("serverquery://$ts3_username:$ts3_password@$ts3_host:$ts3_q_port/?server_port=$ts3_s_port&blocking=0");
$ts3->selfUpdate(array('client_nickname'=> $ts3_nick));
TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryWaitTimeout", "onWaitTimeout");
TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyCliententerview", "onClientEnterView");
$ts3->notifyRegister("server");
while(1)
{
$ts3->getAdapter()->wait();
}
function onWaitTimeout($time, TeamSpeak3_Adapter_Abstract $adapter)
{
if($adapter->getQueryLastTimestamp() < time()-300)
{
$adapter->request('clientupdate');
}
}
function onClientEnterView(TeamSpeak3_Adapter_ServerQuery_Event $event){
global $group;
global $ts3;
global $selectedOnes;
$userInfo = $event->getData();
$client = $ts3->clientGetByDbId($userInfo['client_database_id']);
$groups = array_filter(explode(',', $client->client_servergroups));
if(in_array($client->connection_client_ip, $selectedOnes)){
if(in_array($group, $groups, TRUE)){
return;
}else{
$ts3->serverGroupClientAdd($group,$userInfo['client_database_id']);
return;
}
}
}