Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <html>
  2. <head>
  3. </head>
  4.  
  5.  
  6. <body>
  7.  
  8. <?php
  9.  
  10.  
  11. /////////////////////////////////////////////////
  12. /* ==============[CONFIGURATION]============== */
  13. $host = "10.10.12.101"; //IP of the server
  14. $port = "10011"; //Query port
  15. $server_port = "9987"; //Virtual server port
  16. $user = "1"; //Query login username
  17. $pass = ""; //Query login password
  18. $name = "PHP_BOT//DEV_MULTI"; //Bot's name
  19. $channel = "25"; //Bot's Channel (0 = Default)
  20. $cpw = ""; //Password of Bots Channel
  21. $debug = 1; //Shows more Infos
  22. /////////////////////////////////////////////////
  23.  
  24.  
  25.  
  26. // load framework files
  27. require_once("libraries/TeamSpeak3/TeamSpeak3.php");
  28.  
  29.  
  30. //try {
  31. // connect to local server in non-blocking mode, authenticate and spawn an object for the virtual server on port 9987
  32. $ts3 = TeamSpeak3::factory("serverquery://".$user.":".$pass."@".$host.":".$port."/?server_port=".$server_port."&nickname=".$name."&blocking=0");
  33.  
  34.  
  35.  
  36. //move into channel
  37. if ($channel == "0") {
  38. } else {
  39. $ts3->clientMove($ts3->whoamiGet("client_id"), $channel, $cpw);
  40. if ($debug) {
  41. echo "<font color='lightgreen'>Moved: ".$ts3->whoamiGet("client_id")." to Channel ID $channel!</font><br/>";
  42. };
  43. };
  44.  
  45. print_r($ts3);
  46.  
  47.  
  48.  
  49. // get notified on incoming private messages
  50. $ts3->notifyRegister("textchannel");
  51. $ts3->notifyRegister("textprivate");
  52. if ($debug) {
  53. echo "<font color='lightgreen'>Registered for textchannel and textprivate</font><br/>";
  54. };
  55.  
  56.  
  57. // register a callback for notifyTextmessage events
  58. TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyTextmessage", "onTextmessage");
  59.  
  60. // wait for events
  61. $waiting = TRUE;
  62. while(sleep(10)) $ts3->getAdapter()->wait();
  63.  
  64.  
  65. // define a callback function
  66. function onTextmessage(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host) {
  67. require_once("libraries/TeamSpeak3/TeamSpeak3.php");
  68. global $ts3;
  69. echo "<br/>Client " . $event["invokername"] . " sent textmessage: " . $event["msg"]."<br/>";
  70.  
  71. $command = explode(" ", $event["msg"]);
  72.  
  73.  
  74. switch ($command[0]) {
  75. case "!help":
  76. try {$ts3->clientGetByName($event["invokername"])->message("Hallo");} catch(TeamSpeak3_Exception $error) {};
  77.  
  78. }
  79.  
  80.  
  81. };
  82.  
  83.  
  84. //} catch(TeamSpeak3_Exception $e) {
  85. // echo "Error " . $e->getCode() . ": " . $e->getMessage();
  86. //}
  87.  
  88.  
  89. ?>
  90.  
  91.  
  92.  
  93. </body>
  94. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement