Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <?php
- /////////////////////////////////////////////////
- /* ==============[CONFIGURATION]============== */
- $host = "10.10.12.101"; //IP of the server
- $port = "10011"; //Query port
- $server_port = "9987"; //Virtual server port
- $user = "1"; //Query login username
- $pass = ""; //Query login password
- $name = "PHP_BOT//DEV_MULTI"; //Bot's name
- $channel = "25"; //Bot's Channel (0 = Default)
- $cpw = ""; //Password of Bots Channel
- $debug = 1; //Shows more Infos
- /////////////////////////////////////////////////
- // load framework files
- require_once("libraries/TeamSpeak3/TeamSpeak3.php");
- //try {
- // connect to local server in non-blocking mode, authenticate and spawn an object for the virtual server on port 9987
- $ts3 = TeamSpeak3::factory("serverquery://".$user.":".$pass."@".$host.":".$port."/?server_port=".$server_port."&nickname=".$name."&blocking=0");
- //move into channel
- if ($channel == "0") {
- } else {
- $ts3->clientMove($ts3->whoamiGet("client_id"), $channel, $cpw);
- if ($debug) {
- echo "<font color='lightgreen'>Moved: ".$ts3->whoamiGet("client_id")." to Channel ID $channel!</font><br/>";
- };
- };
- print_r($ts3);
- // get notified on incoming private messages
- $ts3->notifyRegister("textchannel");
- $ts3->notifyRegister("textprivate");
- if ($debug) {
- echo "<font color='lightgreen'>Registered for textchannel and textprivate</font><br/>";
- };
- // register a callback for notifyTextmessage events
- TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyTextmessage", "onTextmessage");
- // wait for events
- $waiting = TRUE;
- while(sleep(10)) $ts3->getAdapter()->wait();
- // define a callback function
- function onTextmessage(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host) {
- require_once("libraries/TeamSpeak3/TeamSpeak3.php");
- global $ts3;
- echo "<br/>Client " . $event["invokername"] . " sent textmessage: " . $event["msg"]."<br/>";
- $command = explode(" ", $event["msg"]);
- switch ($command[0]) {
- case "!help":
- try {$ts3->clientGetByName($event["invokername"])->message("Hallo");} catch(TeamSpeak3_Exception $error) {};
- }
- };
- //} catch(TeamSpeak3_Exception $e) {
- // echo "Error " . $e->getCode() . ": " . $e->getMessage();
- //}
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement