$suspect->kick(TeamSpeak3::KICK_SERVER, 'Violation of the multiple connection rule!');
$suspect->ban(0 ,'Violation of the multiple connection rule!');
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$tsHandle = TeamSpeak3::factory("serverquery://serveradmin:11ANRDdk@127.0.0.1:10011/?server_port=9987");
$whitelist = array('127.0.0.3', '127.0.0.2');
$clientIPs = array();
foreach($tsHandle->clientList(array("client_type" => 0)) as $client)
{
if(in_array($client->connection_client_ip, $clientIPs))
{
if(!in_array($client->connection_client_ip, $whitelist))
{
foreach($tsHandle->clientList(array("connection_client_ip" => $client->connection_client_ip)) as $suspect)
{
try {
// Replace this line with the code above
} catch(TeamSpeak3_Exception $e) {
echo "Error ".$e->getCode().": ".$e->getMessage();
}
}
}
} else {
array_push($clientIPs, $client->connection_client_ip);
}
}
He didn't mean server instances, he meant multiple instances in a way to mention multiple identities/clients with the same IP address.Isnt that exactly what you ask for?
![]()
serverinstance_pending_connections_per_ip is not about servers, it's about clients. The only difference is that it checks over the whole instance so you can't be on two servers of the same time if that's set to 1He didn't mean server instances, he meant multiple instances in a way to mention multiple identities/clients with the same IP address.
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$tsHandle = TeamSpeak3::factory("serverquery://serveradmin:11ANRDdk@127.0.0.1:10011/?server_port=9987");
$whitelist = array('127.0.0.3', '127.0.0.2');
$maxConnections = 2;
$clientIPs = array();
foreach($tsHandle->clientList(array("client_type" => 0)) as $client)
{
if(in_array(strval($client->connection_client_ip), $clientIPs) && array_count_values($clientIPs)[strval($client->connection_client_ip)] >= $maxConnections)
{
if(!in_array($client->connection_client_ip, $whitelist))
{
foreach($tsHandle->clientList(array("connection_client_ip" => $client->connection_client_ip)) as $suspect)
{
try {
// Replace this line with the code above
} catch(TeamSpeak3_Exception $e) {
echo "Error ".$e->getCode().": ".$e->getMessage();
}
}
}
} else {
array_push($clientIPs, strval($client->connection_client_ip));
}
}
Isnt that exactly what you ask for?
![]()
I did not find this option in YaTQA, is it just for pro?
I just made a little example for you. Replace line 17 with the code below depending on what you want you want.
Kick all clients with the same IP:$suspect->kick(TeamSpeak3::KICK_SERVER, 'Violation of the multiple connection rule!');
Ban all clients with the same IP:$suspect->ban(0 ,'Violation of the multiple connection rule!');
PHP:<?php require_once("libraries/TeamSpeak3/TeamSpeak3.php"); $tsHandle = TeamSpeak3::factory("serverquery://serveradmin:11ANRDdk@127.0.0.1:10011/?server_port=9987"); $whitelist = array('127.0.0.3', '127.0.0.2'); $clientIPs = array(); foreach($tsHandle->clientList(array("client_type" => 0)) as $client) { if(in_array($client->connection_client_ip, $clientIPs)) { if(!in_array($client->connection_client_ip, $whitelist)) { foreach($tsHandle->clientList(array("connection_client_ip" => $client->connection_client_ip)) as $suspect) { try { // Replace this line with the code above } catch(TeamSpeak3_Exception $e) { echo "Error ".$e->getCode().": ".$e->getMessage(); } } } } else { array_push($clientIPs, $client->connection_client_ip); } }
Just use an infinite loop or use an event listener that get's triggered when somebody joins your server.How can I make this always active? So I don't have to exec this script everytime I see someone connecting multiple times? I would like this to be active 24/7 and "taking care" of server
Can you help me with this? I'm not so experienced with PHP and that stuff.
Couldn't find that!
Oh gosh it was in the statistics barYou can't or couldn't?
In case you can't find it, here's a step by step tutorial:
![]()