Advertisement
B1uscr34m

Teamspeak TS 3 TS3 Plugin PHP Script - Marquee as Name

Aug 21st, 2015
1,906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.15 KB | None | 0 0
  1. <?php
  2. $GLOBALS["debug"] = false;
  3. $GLOBALS["replace_empty_space"] = false;
  4.  
  5. $clientquery_port = "25639";
  6. $max = 28;
  7. $time = 150000;//100000
  8. $maxtime = 5;
  9. $mintime = 3;
  10. $fp = fsockopen("localhost", $clientquery_port);
  11. echo fgets($fp);
  12. echo fgets($fp);
  13. echo fgets($fp);
  14. $n = 0;
  15. $name = getName($fp);
  16.  
  17. function getName($fp) {
  18.     // $name = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras egestas sem dolor, id convallis felis euismod vel. Mauris feugiat lacus neque, eget rutrum felis fermentum non. Nunc iaculis metus at elementum viverra. Maecenas lacinia velit id velit malesuada scelerisque. Cras a nibh eu tellus cursus lacinia non at erat. Curabitur ac eros imperdiet, sollicitudin justo ut, posuere mauris. Sed elementum non magna ac scelerisque.";
  19.     // $name = "Bluscream ♥ Blubb";
  20.     // $name = file_get_contents("files\name.txt");
  21.     $name = getNameFromTS($fp);
  22.     $name = str_replace("\n", " ", $name);
  23.     return $name;
  24. }
  25.  
  26. function getNameFromTS($fp) {
  27.     fputs($fp,"whoami\n");
  28.     $str001 = fgets($fp);
  29.     echo fgets($fp);
  30.     scriptlog($str001."\n");
  31.     $clid = explode("=",explode(" ",$str001)[0])[1];
  32.     scriptlog($clid."\n");
  33.     fputs($fp, "clientvariable clid=".$clid." client_nickname\n");
  34.     $str002 = fgets($fp);
  35.     echo fgets($fp);
  36.     scriptlog($str002."\n");
  37.     $name = teamspeak_unescape(explode("=",explode(" ",$str002)[1])[1]);
  38.     scriptlog($name."\n");
  39.     return $name;
  40. }
  41.  
  42.  
  43. function laufjungeback($name,$i,$max){
  44.  $hidden_space = strlen($name);
  45.  scriptlog($i."\n");
  46.  $asci = " ";
  47.  $after_ascis = $max-$i+strlen($name);
  48.  $before_ascis = $i;
  49.  $full_length = $after_ascis+$before_ascis;
  50.  if($i > $full_length){
  51.   $i = $i-(explode(".",$i/$full_length."")[0]*$full_length)-1;
  52.   scriptlog("ni: ".$i."\n");
  53.  }
  54. if($i < 0){
  55.   $i = $i-(explode(".",$i/$full_length."")[0]*$full_length)+$full_length-1;
  56.   scriptlog("ni: ".$i."\n");  
  57.  }
  58.  
  59.  $after_ascis = $max-$i+strlen($name);
  60.  $before_ascis = $i;
  61.  if($GLOBALS["replace_empty_space"]){
  62.   $name = str_replace(" ", $asci, $name);
  63.  }
  64.  scriptlog($after_ascis+$before_ascis+strlen($name)."\n");
  65.  
  66.  for ($n=0; $n <= $after_ascis; $n++) {
  67.   $name .= $asci;
  68.  }
  69.  
  70.  for ($n=0; $n <= $before_ascis; $n++) {
  71.   $name = $asci.$name;
  72.  }
  73.  return substr($name, $hidden_space, $max);
  74. }
  75. /*function laufjunge2($name,$i){
  76.     $max = 30;
  77.     $asci = "█";
  78.     $name = str_replace(" ", $asci, $name);
  79.     $name = str_pad($name, $i+strlen($name), $asci,STR_PAD_LEFT);
  80.     $name = str_pad($name, $max-$i, $asci, STR_PAD_BOTH);
  81.     return $name;
  82. }*/
  83. function teamspeak_escape($str){
  84.     return str_replace(" ", "\\s",str_replace("\n", "", $str));
  85. }
  86. function teamspeak_unescape($str){
  87.     return str_replace("\\s", " ",str_replace("\n", "", $str));
  88. }
  89. function scriptlog($msg){
  90.     if($GLOBALS["debug"]) {
  91.         echo $msg;
  92.     }
  93. }
  94. while(1){
  95.     //$time = rand($mintime,$maxtime);
  96.     $nam = laufjungeback($name,$n,$max);
  97.     // fputs($fp,"clientupdate client_nickname=!\s".teamspeak_escape($nam)."\s!\n");
  98.     fputs($fp,"clientupdate client_nickname=!\s".teamspeak_escape($nam)."\n");
  99.     scriptlog($nam."\n");
  100.     //echo fgets($fp);
  101.     $n--;
  102.     usleep($time);
  103.     //sleep($time+5);
  104. }
  105. fclose($fp);
  106. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement