- Additional Requirements
- Linux server
- PHP
- Query-access
Code:
<?PHP
/**
* clientCountToServername.php
*
* Is a small script to include the amount of online users into the servername.
*
* by iKaros - <[email protected]> with the ts3admin.class framework <http://ts3admin.info/>
*
*/
/*-------SETTINGS-------*/
$ts3_ip = '127.0.0.1';
$ts3_queryport = 10011;
$ts3_user = 'username';
$ts3_pass = 'password';
$ts3_port = 9987;
/*----------------------*/
$xyz = 1;
#Include ts3admin.class.php
require("../lib/ts3admin.class.php");
while($xyz == 1) {
#build a new ts3admin object
$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
if($tsAdmin->getElement('success', $tsAdmin->connect())) {
#login as serveradmin
$tsAdmin->login($ts3_user, $ts3_pass);
#select teamspeakserver
$tsAdmin->selectServer($ts3_port);
#get clientlist
$clients = $tsAdmin->clientList();
#set Nickname of the Bot
$tsAdmin->setName("Nickname");
#getting Server Slots
$serverInfo = $tsAdmin->serverInfo();
$maxClients = $serverInfo['data']['virtualserver_maxclients'];
#set Nickname of the query
$tsAdmin->setName("Nickname");
$allSlots = $tsAdmin->serverInfo();
echo $allSlots[virtualserver_maxclients];
#set Servername
$newServerName = "I am one example by iKaros | " . "[" . count($clients['data']) . $maxClients;
echo $newServerName;
$tsAdmin->serverEdit(array('virtualserver_name' => $newServerName));
}
// amount of time to wait before checking again, in seconds.
sleep(30); //Recommended not to touch
}
About it:
This script will allow you to show the people connected to your server in the server's title. This very simple framework to edit is a very simple installation tutorial in the following languages:
- English
- Spanish (in 3.1 it will be released)
This script can not be sold, or any other type of income obtained without the exclusive permission of its own author (iKaros).
Do you have problems or doubts? Leave it in the comments and I will answer you.
Do you want to donate? Open me PM
Do you want to collaborate? Leave in the comments everything you want to say or contribute.
Changelog:
1/08/2018 |/\| 2.3 release - Now you can change the name of the bot and also the adjustment of slots is now automatic.