Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- //header("refresh: 1;");
- /**
- * clientkick.php
- *
- * Is a small script to demonstrate how to kick a client via ts3admin.class
- *
- * by par0noid solutions - ts3admin.info
- *
- */
- /*-------SETTINGS-------*/
- $ts3_ip = '127.0.0.1';
- $ts3_queryport = 10011;
- $ts3_user = 'serveradmin';
- $ts3_pass = 'sy5SnzRJ';
- $ts3_port = 9987;
- /*----------------------*/
- #Include ts3admin.class.php
- require("lib/ts3admin.class.php");
- #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);
- global $tsAdmin;
- $tsAdmin->setName("KAROL - BOT");
- $clients = $tsAdmin->clientList();
- echo count($clients['data']) . ' clients on selected server<br><br>';
- print_r($tsAdmin->clientList());
- echo"<br><br>";
- $xd = $tsAdmin->clientList();
- foreach($xd['data'] as $key)
- {
- if($key["cid"] == 2)
- {
- $file = 'text.txt';
- $options = array();
- $channels = array();
- //$key['cid'] = $TAMTAID; //zamieniamy na clid na tego gracza
- $client = $tsAdmin->getElement('data', $tsAdmin->clientInfo($key['clid'])); //
- $client_cdbid = $client['client_database_id'];
- $client_name = $client['client_nickname'];
- $keywords = explode(",", $client['client_servergroups']);
- if(!is_writable($file))
- {
- $handle = fopen($file, "w+");
- fclose($handle);
- echo "Tworzymy plik!";
- $current = file_get_contents($file);
- $array = array();
- $channel_properties = array("channel_properties" => array());
- $channel_list = array("channel_list" => array());
- $file_data = array("channels_cid_order_start"=>21, "channels_cid_order"=>0, "channels_count"=>0, "channels_spacer"=>0, "channels_max"=>50);
- //$kocham2 = array("cid"=>"1", "cdbid"=>"2");
- //array_push($channel_list["channel_list"], $kocham2);
- $channel_properties["channel_properties"] = $file_data;
- $data = $channel_properties + $channel_list;
- $result = $array + $data;
- $json = json_encode(($result), true);
- if(file_put_contents($file, $json)) echo "Zapisujemy dane:)";
- }
- $json_file = json_decode(file_get_contents($file), true);
- if(in_array(6, $keywords) || in_array(7, $keywords)) // sprawdzanie czy grasz ma rangi...
- {
- $channel_have_cid = false;
- foreach($json_file['channel_list'] as $key8 => $value8)
- {
- if($client_cdbid == $value8['cdbid'])
- {
- echo "Masz już kanał bydlaku!";
- $channel_have = true;
- $channel_have_cid = $value8['cid'];
- break;
- }
- }
- if(!$channel_have)
- {
- //print_r($client);
- print_r($json_file['channel_properties']);
- foreach($json_file['channel_properties'] as $key1 => $value1)
- {
- $options[$key1] = $value1;
- echo "<br>$key1 => $value1";
- }
- echo "<br>";
- //$kocham3 = array("id"=>"NOWE", "cdbid"=>"2");
- //array_push($json_file["channel_list"], $kocham3);
- //print_r($json_file['channel_list']);
- if($options['channels_cid_order'] == 0)
- $options['channels_cid_order'] = $options['channels_cid_order_start'];
- $options['channels_count']++;
- $options['channels_spacer']++; // ladowanie spacera co 10 kanalow
- $channel_cid = $tsAdmin->channelCreate(array("channel_name"=> $options['channels_count'].". » ".$client_name." Random liczba:".rand(1, 100), "channel_order"=>$options['channels_cid_order'], "channel_flag_permanent"=>TRUE));
- $tsAdmin->channelCreate(array("channel_name"=>"1.", "cpid"=>$channel_cid['data']['cid'], "channel_flag_permanent"=>TRUE));
- $tsAdmin->channelCreate(array("channel_name"=>"2.", "cpid"=>$channel_cid['data']['cid'], "channel_flag_permanent"=>TRUE));
- $tsAdmin->clientMove($key['clid'], $channel_cid['data']['cid']);
- $tsAdmin->clientPoke($key['clid'], "masz juz kanal elo");
- $tsAdmin->channelGroupAddClient(5, $channel_cid['data']['cid'], $client_cdbid);
- $order = $channel_cid['data']['cid'];
- if($options['channels_spacer'] == 10)
- {
- $spacer_cid = $tsAdmin->channelCreate(array("channel_name"=> "[cspacer".rand(1000, 1000000)."]━━━◥◣◆◢◤━━━", "channel_order"=>$channel_cid['data']['cid'], "channel_flag_permanent"=>TRUE));
- $order = $spacer_cid['data']['cid'];
- $options['channels_spacer'] = 0;
- }
- $json_file['channel_properties']['channels_cid_order_start'] = $options['channels_cid_order_start'];
- $json_file['channel_properties']['channels_cid_order'] = $order;
- $json_file['channel_properties']['channels_count'] = $options['channels_count'];
- $json_file['channel_properties']['channels_spacer'] = $options['channels_spacer'];
- $json_file['channel_properties']['channels_max'] = $options['channels_max'];
- echo "<br>";
- echo "<br>";
- print_r($json_file);
- file_put_contents($file, "");
- $channel_list_add = array("cid"=>$channel_cid['data']['cid'], "cdbid"=>$client_cdbid);
- array_push($json_file["channel_list"], $channel_list_add);
- $jsonsss = json_encode($json_file, true);
- if(file_put_contents($file, $jsonsss)) echo "<b>ZAPISUJEMY DANE!!!</b>";
- /*
- $current1 = file_get_contents($file);
- $current1 = array("channels_cid_order_start"=>$options['channels_cid_order_start'], "channels_cid_order"=>$order, "channels_count"=>$options['channels_count'], "channels_spacer"=>$options['channels_spacer'], "channels_max"=>50);
- $json1 = json_encode($current1);
- if(file_put_contents($file, $json1)) echo "<b>ZAPISUJEMY DANE!!!</b>";
- */
- }else {
- //$tsAdmin->clientKick($key['clid'], $kickMode = "channel", $kickmsg = "MASZ KURWA KANAL"); // MASZ JUŻ KANAL!!!
- // lub movamy...
- $tsAdmin->clientMove($key['clid'], $channel_have_cid);
- // lub poke
- $tsAdmin->clientPoke($key['clid'],$msg="XD");
- }
- }else{ //jezeli nie ma to go wyrzuci
- echo "typek nie ma rangi";
- $tsAdmin->clientKick($key['clid'], $kickMode = "channel", $kickmsg = "NIE MASZ KURWA RANGI"); // JEZELI NIE MA RANGI KICK!!!
- $tsAdmin->sendMessage(1, $target = $key['clid'], "Nie masz odpowiednich rang żeby móc zakładać kanały!!"); // LUB WIADOMOSC
- }
- }
- }
- }else{
- echo 'Connection could not be established.';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement