You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 308 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Teamspeak Block [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Sun Oct 03, 2004 4:59 am Reply with quoteBack to top

Hello,
How can i put a block on my site that shows if my ts is online wich people
are on it and in wich channel or something can somebody tell me how to add it?
Find all posts by RaverView user's profileSend private message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Sun Oct 03, 2004 5:15 am Reply with quoteBack to top

there 20 ppl online but nobody reacts Crying or Very sad

_________________
[b]www.web-corner.net[/b]
Find all posts by RaverView user's profileSend private message
jaj
Corporal
Corporal


Joined: Feb 25, 2004
Posts: 56


PostPosted: Sun Oct 03, 2004 6:08 am Reply with quoteBack to top

You looking for something like this.... http://78thlightning.com/modules.php?name=TS
Find all posts by jajView user's profileSend private message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Sun Oct 03, 2004 7:40 am Reply with quoteBack to top

yeah exactly like that only i want it in a small block in the right side how to make it like that?

_________________
[b]www.web-corner.net[/b]
Find all posts by RaverView user's profileSend private message
jaj
Corporal
Corporal


Joined: Feb 25, 2004
Posts: 56


PostPosted: Sun Oct 03, 2004 4:42 pm Reply with quoteBack to top

This is a simple Teamspeak block with a few added features....Now you may have an issue with placing the block on the right... It will work fine but if a client joins with a long name then block will be streched to fit... Other wise you will be fine...
Just copy this code and paste it into your favorite text editor and save it as block-Teamspeak.php then just activate it.... any issues let me know.....
Code:
<?php




// **** settings - to be edited before first use ****
$serverAddress = "xx.xxx.xx.xxx";  // can be ip address or url
$serverQueryPort = 51234;  // default 51234, must be accessible and usable. check server.ini
$serverUDPPort = 8767;  // default 8767
// **** end of settings ****

if (eregi("block-Teamspeak.php", $PHP_SELF)) {
  Header("Location: index.php");
  die();
}


global $user, $cookie;
getusrinfo($user);
cookiedecode($user);
$username = $cookie[1];

// opens a connection to the teamspeak server
function getSocket($host, $port, $errno, $errstr, $timeout) {
   global $errno, $errstr;
   @$socket = fsockopen($host, $port, $errno, $errstr, $timeout);
        if($socket and fread($socket, 4) == "[TS]") {
            fgets($socket, 128);
            return $socket;
        }// end if
        return false;
}// end function getSocket(...)

// sends a query to the teamspeak server
function sendQuery($socket, $query) {
   fputs($socket, $query."\n");
}

// answer OK?
function getOK($socket) {
        $result = fread($socket, 2);
        fgets($socket, 128);
        return($result == "OK");
}

// closes the connection to the teamspeak server
function closeSocket($socket) {
        fputs($socket, "quit");
        fclose($socket);
}

// retrieves the next argument in a tabulator-separated string (PHP scanf function bug workaround)
function getNext($evalString) {
        $pos = strpos($evalString, "\t");
        if(is_integer($pos)) {
      return substr($evalString, 0, $pos);
        }
        else {
            return $evalString;
        }
}

// removes the first argument in a tabulator-separated string (PHP scanf function bug workaround)
function chopNext($evalString) {
        $pos = strpos($evalString, "\t");
        if(is_integer($pos)) {
      return substr($evalString, $pos + 1);
        }
        else {
           return "";
        }
}

// MAIN PROGRAM START

// establish connection to teamspeak server
$socket = getSocket($serverAddress, $serverQueryPort, $errno, $errstr, 3);
if($socket == false) {
        $content .= "An error connecting to the TeamSpeak server has occured!<br>\n";
        $content .= "Error number: ".$errno."<br>\n";
        $content .= "Error description: ".$errstr."<br>\n";
        return;
}

// select the one and only running server on port 8767
sendQuery($socket, "sel ".$serverUDPPort);

// retrieve answer "OK"
if(!getOK($socket)) {
   die("Server didn't answer &quot;OK&quot; after last command. Aborting.");
}// end if

// retrieve player list
sendQuery($socket,"pl");

// read player info
$playerList = array();
do {
   $playerinfo = fscanf($socket, "%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s");
        list($playerid, $channelid, $receivedpackets, $receivedbytes, $sentpackets, $sentbytes, $d, $d, $totaltime, $idletime, $d, $d, $d, $s, $playername) = $playerinfo;
        if($playerid != "OK") {
               $playerList[$playerid] = array("playerid" => $playerid,
                                           "channelid" => $channelid,
                                           "receivedpackets" => $receivedpackets,
                                           "receivedbytes" => $receivedbytes,
                                           "sentpackets" => $sentpackets,
                                           "sentbytes" => $sentbytes,
                                           "totaltime" => $totaltime,
                                           "idletime" => $idletime,
                                           "playername" => $playername);
        }
} while($playerid != "OK");

// retrieve channel list
sendQuery($socket,"cl");

// read channel info
$channelList = array();
do {
        $channelinfo = "";
        do {
      $input = fread($socket, 1);
      if($input != "\n" && $input != "\r") $channelinfo .= $input;
        } while($input != "\n");

        $channelid = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $codec = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $parent = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $d = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $maxplayers = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $channelname = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $d = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $d = getNext($channelinfo);
        $channelinfo = chopNext($channelinfo);
        $topic = getNext($channelinfo);

        if($channelid != "OK") {
      if($isdefault == "Default") $isdefault = 1; else $isdefault = 0;

               // determine number of players in channel
               $playercount = 0;
               foreach($playerList as $playerInfo) {
                   if($playerInfo[channelid] == $channelid) $playercount++;
               }

               $channelList[$channelid] = array("channelid" => $channelid,
                                             "codec" => $codec,
                                             "parent" => $parent,
                                             "maxplayers" => $maxplayers,
                                             "channelname" => $channelname,
                                             "isdefault" => $isdefault,
                                             "topic" => $topic,
                                             "currentplayers" => $playercount);
   }
} while($channelid != "OK");

// display channel list
$content .= "<table width=\"100%\">\n";
$counter = 0;
foreach($channelList as $channelInfo) {
   // default channel?
        if($channelInfo[isdefault] == 1) {
            $channelname = $channelInfo[channelname];
        } else {
            $channelname = $channelInfo[channelname];
        }

      if ($channelInfo[currentplayers] > 0) {
         $content .= "<tr><td><img src=\"images/bullet_channel.gif\" border=\"0\"></td><td colspan=\"1 \">".$channelname." </td></tr>";
      }

        $counter++;
        foreach ($playerList as $playerInfo) {
           if ($channelInfo[channelid] == $playerInfo[channelid]) {
              $content .= "<tr><td></td><td colspan=0><img src=\"images/bullet_0.gif\" border=\"0\" align=left>".$playerInfo[playername]."</td></tr>\n";
           }
        }
    }

    if($counter == 0) $content .= "<tr><td colspan=\"4\" align=\"CENTER\">No channels</td></tr>\n";
    $content .= "</table>\n";

    // close connection to teamspeak server
    closeSocket($socket);



 

$content .= "<form name=\"testform\">";
$content .= "<input type=\"text\" name=\"NICKNAME\"  size=\"19\" > ";
$content .= "NICKNAME";
$content .= "<br>";
//$content .= "<input type=\"text\" name=\"LOGINNAME\"> LOGIN NAME--For Registered Users";
$content .= "<br>";
//$content .= "<input type=\"text\" name=\"PASSWORD\"> PASSWORD--Registered Users";
//$content .= "<br>";
$content .= "<input type=\"button\" value=\"-->Submit<--\" onClick=\"location.href='teamspeak://$serverAddress: $serverUDPPort/nickname=' + testform.NICKNAME.value \">";
$content .= "<br>";

$content .= "</form>";
$content .="<center><a href=\"http://www.goteamspeak.com\"><img src=\"https://sales.tritoncia.com/images/link_to_teamspeak.gif\" border=\"0\" alt=\"Go to Teamspeak.com\"></a></center>"
 ."";






?>
Find all posts by jajView user's profileSend private message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Sun Oct 03, 2004 10:32 pm Reply with quoteBack to top

im sorry i know it sounds stupid can you tell me exactly what to do cause
i need to upload then i need to activate it i dunno how Wink

_________________
[b]www.web-corner.net[/b]
Find all posts by RaverView user's profileSend private message
jaj
Corporal
Corporal


Joined: Feb 25, 2004
Posts: 56


PostPosted: Mon Oct 04, 2004 3:11 am Reply with quoteBack to top

if you can give me your Teamspeak ip and the query port that you use I will edit the code and put it in the block file for you and email it to you...
Find all posts by jajView user's profileSend private message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Mon Oct 04, 2004 7:33 am Reply with quoteBack to top

ok great thnx
IP: 81.205.200.79 port: 8767
server password: server

_________________
[b]www.web-corner.net[/b]
Find all posts by RaverView user's profileSend private message
DCW_MadMax
Corporal
Corporal


Joined: Mar 20, 2004
Posts: 60


PostPosted: Mon Oct 04, 2004 12:17 pm Reply with quoteBack to top

Hello.
I have been trying to add a second TS block on my site but keep comming up with errors, is it possible to add the second TS block, if so how.

Thankyou.

_________________
dcwarriors.com online gaming community
Image
Find all posts by DCW_MadMaxView user's profileSend private messageVisit poster's website
jaj
Corporal
Corporal


Joined: Feb 25, 2004
Posts: 56


PostPosted: Mon Oct 04, 2004 1:42 pm Reply with quoteBack to top

Raver wrote:
ok great thnx
IP: 81.205.200.79 port: 8767
server password: server

I also need the query port.... ask your TS provider what the query port # is... that is necassary in order for the block to work..
Find all posts by jajView user's profileSend private message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Mon Oct 04, 2004 10:10 pm Reply with quoteBack to top

i host the ts server on my own pc so what u mean with the query port hehe Wink

_________________
[b]www.web-corner.net[/b]
Find all posts by RaverView user's profileSend private message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Mon Oct 04, 2004 10:11 pm Reply with quoteBack to top

ok spotted it heheh

51234

_________________
[b]www.web-corner.net[/b]
Find all posts by RaverView user's profileSend private message
jaj
Corporal
Corporal


Joined: Feb 25, 2004
Posts: 56


PostPosted: Tue Oct 05, 2004 12:42 pm Reply with quoteBack to top

Now you need to open that port on the server that hosts your TS...to allow the script access, to query your TS server..
Find all posts by jajView user's profileSend private message
Raver
Private
Private


Joined: Oct 03, 2004
Posts: 36


PostPosted: Wed Oct 06, 2004 10:56 am Reply with quoteBack to top

Confused what u mean?

_________________
[b]www.web-corner.net[/b]
Find all posts by RaverView user's profileSend private message
jaj
Corporal
Corporal


Joined: Feb 25, 2004
Posts: 56


PostPosted: Wed Oct 06, 2004 12:39 pm Reply with quoteBack to top

What operating system is the server running on?
Find all posts by jajView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.061 Seconds - 216 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::