Junichirou
Member
- Sep 22, 2015
- 4
- 0
- 56
Greetings try to create the script with the above indications but it was not possible, I leave this if someone can help me since the other thread was closed.
Functions of the script: Functions of the script: According to the country assigned, the script must grant an icon of this to the user.
Why do you want it: to distribute the nationalities automatically by a predetermined icon
Screenshots: I do not posses
Other notes: I leave the script code that you try to modify but it did not work.
Functions of the script: Functions of the script: According to the country assigned, the script must grant an icon of this to the user.
Why do you want it: to distribute the nationalities automatically by a predetermined icon
Screenshots: I do not posses
Other notes: I leave the script code that you try to modify but it did not work.
Code:
<?PHP
// Teamspeak config
$teamspeakInfo = array(
'username' => 'serveradmin',
'password' => '',
'host' => '127.0.0.1',
'portQuery' => '10011',
'portServer' => '9987',
'displayname' => 'test'
);
$blacklist = array('CL'); // array('DE', 'HU');
$whitelist = array('CL'); // array('DE', 'HU');
$clientType = 2; // 1 = Everyone, 2 = Ignore Query, 3 = Ignore Clients
$listMode = 1; // 1 = blacklist, 2 = whitelist
$punishMode = 1; // 1 = kick, 2 = ban
$punishMessage = 'Access not allowed.'; // Message the user will see once he got kicked/banned
/*
|--------------------------------------------------------------------------------
| No modifiques nada debajo de esta área a menos que sepas lo que estás haciendo.
|--------------------------------------------------------------------------------
*/
echo "|--------------------------------------|\n| Disallow specific countries |\n|--------------------------------------|\n";
require_once("lib/ts3admin.class.php");
$tsAdmin = new ts3admin($teamspeakInfo['host'], $teamspeakInfo['portQuery']);
if($tsAdmin->getElement('success', $tsAdmin->connect())) {
echo "> Successfully connected to the teamspeak server\n";
$tsAdmin->login($teamspeakInfo['username'], $teamspeakInfo['password']);
echo "> Successfully logged in\n";
$tsAdmin->selectServer($teamspeakInfo['portServer']);
echo "> Successfully selected server ".$teamspeakInfo['portServer']."\n";
$tsAdmin->setName($teamspeakInfo['displayname']);
echo "> Successfully changed name to ".$teamspeakInfo['displayname']."\n";
$connectionInfo = $tsAdmin->whoAmI()['data'];
for(;;){
$clients = $tsAdmin->clientList("-country -ip");
foreach($clients['data'] as $client) {
if ($listMode == 1) {
$invalidCountry = false;
foreach($blacklist as $blacklistCountry){
if($client['client_country'] == "DE")
$client->addservergroup(11); //Servergroup for German Country
if ($client['client_country'] == $blacklistCountry || $client['client_country'] == "") {
switch ($clientType) {
case '1':
$invalidCountry = true;
break;
case '2':
if ($client['client_type'] == 0) {
$invalidCountry = true;
}
break;
case '3':
if ($client['client_type'] == 1) {
$invalidCountry = true;
}
break;
}
}
}
} else if ($listMode == 2) {
$invalidCountry = true;
foreach($whitelist as $whitelistCountry){
if ($client['client_country'] == $whitelistCountry) {
switch ($clientType) {
case '1':
$invalidCountry = false;
break;
case '2':
if ($client['client_type'] == 0) {
$invalidCountry = false;
}
break;
case '3':
if ($client['client_type'] == 1) {
$invalidCountry = false;
}
break;
}
}
}
}
/*
|--------------------------------------------------------------------------------
| Modificamos esto para asignar las banderas correspondientes al pais
|--------------------------------------------------------------------------------
*/
if ($invalidCountry && $connectionInfo['client_id'] != $client['clid']) {
if ($punishMode == 1) {
$tsAdmin->servergroupaddperm ($sgid = 11 );
echo "> test ".$client['client_nickname']." from ".$client['client_country']." -> ".$client['connection_client_ip']."\n";
}
}
}
}
} else {
die('Connection could not be established.');
}
?>