I found a TeamSpeak block, actually I think I posted the code here a while back. Anyway...
I was able to edited the code and adapt it to my purpose. It now only shows the channels that contain players. I got sick of it scrolling through the 50 channels that were empty.
Anyway, there is no major editing needed, you just have to go into the file and insert your TS server data into a single line, and then its done.
It works as a side block, and I removed the connect portion (was bothersome, since our server is passworded anyway). So now it does nothing but show the channel name and the name of the players in that channel. Though I am working on making it show the status of those players, but as I know very little about PHP, I am just screwing around right now.
Last edited by gear on Sun Oct 24, 2004 4:53 am; edited 1 time in total
mrmagoo_83 Sergeant
Joined: Oct 03, 2003
Posts: 88
Posted:
Tue Mar 09, 2004 8:55 am
oops, I guess it would have help if I posted the code.
I am at work now, I will try to post it so people can download it tonight when I get home.
bretonmage Captain
Joined: Feb 21, 2004
Posts: 421
Posted:
Tue Mar 09, 2004 9:53 am
Speaking of the TS block, has anyone ever got the Webpost thingie to work? (so that the login button works)
gear Captain
Joined: May 14, 2003
Posts: 579
Location: Mid-Cities
Posted:
Tue Mar 09, 2004 10:07 am
I could get the ts module working perfectly on my test site for short periods, but then things would go wrong. Something about "[DATABASE ERROR:]1016: Can't open file: 'ts2_user.MYI'. (errno: 145)". I asked a php/sql specialist I know and he used technical terms like "sql-brainfart" when elaborating on the issue .
But during the brief periods of operation I could login.
Well, are we eventually going to be posting the codes for these blocks or is this a just a "woof" thread?
Here let me join in...
My wife is really hot!
Nice site where was the Download for the TS block??
What about the download section? LOL
lol
No man, these are different blocks...
These guys came in here like a gaggle of geese and started honking about their unique blocks and never graced us with the code.
Sorry, I am back, had to go away for a while and never got to post the code, my fault.
But after the anticiaption here it is.....
Code:
<?php
$usemarquee = 0;
$scrolldirection = "Up";
// **** settings - to be edited before first use ****
$serverAddress = "XXX.XXX.XXX.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");
}
// determine number of players in channel
$playercount = 0;
foreach($playerList as $playerInfo) {
if($playerInfo[channelid] == $channelid) $playercount++;
}
// close connection to teamspeak server
closeSocket($socket);
$content .= "</Marquee><br>";
?>
endofmission Sergeant
Joined: Feb 02, 2004
Posts: 104
Posted:
Wed Apr 21, 2004 4:31 am
Great Job, I think this is the best and easiest one I have used. By the way if you dont have the .gif's here I linked them to my site just click the ones you need and save them to your site:
instead of using fscanf for separating the values or using next-functions you should use:
$line=fgets($socket);
$data=explode("\t",$line);
background:
in fscanf whitespaces are recognized as separators even if you use /t (tab) in the format string. not so using explode. explode REALLY only uses /t to separate the data. but carefull, to get this working in the current script, a view lines more have to be changed.
b.t.w. i don't think this is a bug in fscanf. it's just the way this function works...
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