View Single Post
teamspeak problem
Old
  (#1 (permalink))
barrelo0omonkeys
Junior Member
 
Status: Offline
Posts: 5
Join Date: Feb 2006
teamspeak problem - 02-18-2006, 06:34 PM

// **** Configuration ****
var $sitetitle = "blades of death"; // The Title of your Teamspeak Server
var $serverAddress = "66.55.134.18"; // The IP of your Teamspeak server, (don't include the port here)
var $serverQueryPort = 51234; // TeamSpeak QueryPort.. You usually don't need to change this (Standard 51234)
var $serverUDPPort = 8767; // UDP Port of your Teamspeak, This is the port that goes with the IP (Standard 8767)
var $tablewidth = "153"; // The Width of the teamspeak block (optimal 153)
var $serverpassword = "bod"; // Server Password. If you don't have a password set to "".
//
// **** Configuration ****
//-------------------------------------------------------------------------------------------------
var $themename = "ts-viewer"; // Do not change this, directory where graphics are found under templates.
//-------------------------------------------------------------------------------------------------
//
// This is the end of the configuration section. Don't modify anything below this line.
//
//-------------------------------------------------------------------------------------------------
var $socket;
var $serverStatus = "offline";
var $playerList = array();
var $channelList = array();
function getSocket($host, $port, $errno, $errstr, $timeout) {
unset($socket);
$socket=0;// added
$attempts = 1;
while($attempts <= 1 and !$socket) {
$attempts++;
@$socket = fsockopen($host, $port, $errno, $errstr, $timeout);
$this->errno = $errno;
$this->errstr = $errstr;
if($socket and fread($socket, 4) == "[TS]") {
fgets($socket, 128);
return $socket;
}
}
return false;
}
function sendQuery($socket, $query) {
fputs($socket, $query."\n");
}
function getOK($socket) {
$result = fread($socket, 2);
fgets($socket, 128);
return($result == "OK");
}
function closeSocket($socket) {
fputs($socket, "quit");
fclose($socket);
}
function getNext($evalString) {
$pos = strpos($evalString, "\t");
if(is_integer($pos)) {
return substr($evalString, 0, $pos);
} else {
return $evalString;
}
}
function chopNext($evalString) {
$pos = strpos($evalString, "\t");
if(is_integer($pos)) {
return substr($evalString, $pos + 1);
} else {
return "";
}
}
function stripQuotes($evalString) {
if(strpos($evalString, '"') == 0) $evalString = substr($evalString, 1, strlen($evalString) - 1);
if(strrpos($evalString, '"') == strlen($evalString) - 1) $evalString = substr($evalString, 0, strlen($evalString) - 1);
return $evalString;
}
function getVerboseCodec($codec) {
if($codec == 0) {
$codec = "CELP 5.1 Kbit";
} elseif($codec == 1) {
$codec = "CELP 6.3 Kbit";
} elseif($codec == 2) {
$codec = "GSM 14.8 Kbit";
} elseif($codec == 3) {
$codec = "GSM 16.4 Kbit";
} elseif($codec == 4) {
$codec = "CELP Windows 5.2 Kbit";
} elseif($codec == 5) {
$codec = "Speex 3.4 Kbit";
} elseif($codec == 6) {
$codec = "Speex 5.2 Kbit";
} elseif($codec == 7) {
$codec = "Speex 7.2 Kbit";
} elseif($codec == 8) {
$codec = "Speex 9.3 Kbit";
} elseif($codec == 9) {
$codec = "Speex 12.3 Kbit";
} elseif($codec == 10) {
$codec = "Speex 16.3 Kbit";
} elseif($codec == 11) {
$codec = "Speex 19.5 Kbit";
} elseif($codec == 12) {
$codec = "Speex 25.9 Kbit";
} else {
$codec = "unknown (".$codec.")";
}
return $codec;
}
function getInfo() {
$errno=0; // added
$errstr=0; // added
$isdefault=0; // added
$this->socket = $this->getSocket($this->serverAddress, $this->serverQueryPort, $errno, $errstr, 0.3);
if($this->socket == false) {
return;
echo ("No Server");
} else {
$this->serverStatus = "online";
$this->sendQuery($this->socket, "sel ".$this->serverUDPPort);
if(!$this->getOK($this->socket)) {
echo "Server didn't answer \"OK\" after last command. Aborting.";
return;
}
$this->sendQuery($this->socket,"pl");
$this->playerList = array();
do {
$playerinfo = fscanf($this->socket, "%s %d %d %d %d %d %d %d %d %d %d %d %d %s %s %s");
list($playerid, $channelid, $receivedpackets, $receivedbytes, $sentpackets, $sentbytes, $paketlost, $pingtime, $totaltime, $idletime, $privileg, $userstatus, $attribute, $s, $playername, $playername2) = $playerinfo;
if($playerid != "OK") {
if (strcmp($playername2,"\"\"")&& $playername2[0]!="\"") $playername=$playername." ".$playername2;
$this->playerList[$playerid] = array(
"playerid" => $playerid,
"channelid" => $channelid,
"receivedpackets" => $receivedpackets,
"receivedbytes" => $receivedbytes,
"sentpackets" => $sentpackets,
"sentbytes" => $sentbytes,
"paketlost" => $paketlost / 100,
//-------------------------------------------------------------------------------------------------
"pingtime" => $pingtime,
"totaltime" => $totaltime,
"idletime" => $idletime,
"privileg" => $privileg,
"userstatus" => $userstatus,
"attribute" => $attribute,
//-------------------------------------------------------------------------------------------------
"s" => $s,
"playername" => $this->stripQuotes($playername)
);
}
} while($playerid != "OK");
$this->sendQuery($this->socket,"cl");
$this->channelList = array();
do {
$channelinfo = "";
do {
$input = fread($this->socket, 1);
if($input != "\n" && $input != "\r") $channelinfo .= $input;
} while($input != "\n");
$channelid = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$codec = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$parent = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$d = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$maxplayers = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$channelname = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$d = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$d = $this->getNext($channelinfo);
$channelinfo = $this->chopNext($channelinfo);
$topic = $this->getNext($channelinfo);
if($channelid != "OK") {
if($isdefault == "Default") $isdefault = 1; else $isdefault = 0;
$playercount = 0;
foreach($this->playerList as $playerInfo) {
if($playerInfo['channelid'] == $channelid) $playercount++;
}
$this->channelList[$channelid] = array(
"channelid" => $channelid,
"codec" => $codec,
"parent" => $parent,
"maxplayers" => $maxplayers,
"channelname" => $this->stripQuotes($channelname),
"isdefault" => $isdefault,
"topic" => $this->stripQuotes($topic),
"currentplayers" => $playercount);
}
} while($channelid != "OK");
$this->closeSocket($this->socket);
}
}
}
$tss2info = new tss2info;
//-------------------------------------------------------------------------------------------------
?>






why doesnt this work i thought had everything on there right but i guess not

heres the site bladesofdeath.net/bod
   
Reply With Quote