Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 03-05-2008, 07:07 AM
majorj0nny majorj0nny is offline
 
Join Date: May 2005
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default teamspeak scrip mod

I use this script :

Quote:

...........................


// Main function (queries, sorts and displays the teamspeak serverinfo). Its code is not
// very readable... well what shall I say about it... it was hard to write so it should
// be hard to read >
function displayTeamspeak($serverAddress, $serverUDPPort=8767, $serverQueryPort=51234) {
$serverInfo = $this->queryTeamspeakServer($serverAddress, $serverUDPPort, $serverQueryPort);

print("<tr>\n<td class=\"alt1\">\n<table id=\"teamspeakdisplay\" name=\"teamspeakdisplay\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td>\n");
if ($serverInfo["queryerror"] != 0) {
$popupInfo = "Server address: " . $serverAddress . (($serverUDPPort != 8767) ? (":" . $serverUDPPort): "");
if ($serverInfo["queryerror"] == 1) {
$popupInfo .= ", Error: could not connect to query port";
} else {
$popupInfo .= ", Error: no server running on port " . $serverUDPPort;
}
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/teamspeak_offline.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
print("Server offline");
print("</td></tr></table>\n");
} else {
$this->sortServerInfo($serverInfo);

// Generate javascript for teamspeak hyperlinks
$jsTeamspeakId = str_replace(".", "_", $serverAddress) . "_" . $serverUDPPort;
print("<script type=\"text/javascript\">\n<!--\n");
print("function enterServer_" . $jsTeamspeakId . "() {\n");
print(" enterSubChannel_" . $jsTeamspeakId . "(null, false, null);\n");
print("}\n");
print("function enterChannel_" . $jsTeamspeakId . "(channelName, channelPassworded) {\n");
print(" enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, null);\n");
print("}\n");
print("function enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, subChannelName) {\n");
print(" var serveraddress = 'teamspeak://" . $serverAddress . ":" . $serverUDPPort . "';\n");
print(" var nickname=window.prompt('Enter your nickname');\n");
print(" if (nickname == null) {\n");
print(" return;\n");
print(" } else if (nickname == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter your nickname');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"/nickname=\" + nickname;\n");
if ($serverInfo["serverinfo"]["server_password"] == "1") {
print(" var password=window.prompt('Enter the teamspeak server password for " . $serverInfo["serverinfo"]["server_name"] . "');\n");
print(" if (password == null) {\n");
print(" return;\n");
print(" } else if (password == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter a server password');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"?password=\" + password;\n");
}
print(" if (channelName != null) { serveraddress = serveraddress + \"?channel=\" + channelName; }\n");
print(" if (channelPassworded) {\n");
print(" var channelpassword=window.prompt('Enter the channel password for channel ' + channelName);\n");
print(" if (channelpassword == null) {\n");
print(" return;\n");
print(" } else if (channelpassword == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter a channel password');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"?channelpassword=\" + channelpassword;\n");
print(" }\n");
print(" if (subChannelName != null) { serveraddress = serveraddress + \"?subchannel=\" + subChannelName; }\n");
print(" window.location=serveraddress;\n");
print("}\n");
print("//--></script>\n");

$popupInfo = "Server address: " . $serverAddress . (($serverUDPPort != 8767) ? (":" . $serverUDPPort): "") . ", Max players: " . $serverInfo["serverinfo"]["server_maxusers"] . ", Uptime: " . $this->_formatTime($serverInfo["serverinfo"]["server_uptime"]);

// Print the topmost element of the teamspeak tree
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/teamspeak_online.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeakserver\" href=\"javascript:enterServer_" . $jsTeamspeakId . "();\">");
print(str_replace(" ", "&nbsp;", htmlspecialchars($serverInfo["serverinfo"]["server_name"])));
print("</a>");
print("</td></tr></table>\n");

// Count the number of channels to be listed:
$currentchannels = 0;
foreach($serverInfo["channellist"] as $channelInfo) {
if ($channelInfo["parent"] == -1) {
$currentchannels++;
}
}

// Initialize the channelcounter to zero
$counter = 0;

// Loop through all channels:
foreach($serverInfo["channellist"] as $channelInfo) { if ($channelInfo["parent"] == -1) {

// determine number of players in channel
$currentplayers = 0;
foreach($serverInfo["playerlist"] as $playerInfo) {
if($playerInfo[channelid] == $channelInfo["channelid"]) $currentplayers++;
}

// Count the number of channels to be listed:
$currentplayersandsubchannels = $currentplayers;
foreach($serverInfo["channellist"] as $subchannelInfo) {
if ($subchannelInfo["parent"] == $channelInfo["channelid"]) {
$currentplayersandsubchannels++;
}
}

$popupInfo = "Max players: " . $channelInfo["maxplayers"] . ", Codec: " . $this->_getCodecName($channelInfo["codec"]);
if ($channelInfo["topic"] != "") { $popupInfo = $popupInfo . ", Topic: " . $channelInfo["topic"]; }

// Display channel:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakchannel\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeakchannel\" href=\"javascript:enterChannel_" . $jsTeamspeakId . "('" . $channelInfo["channelname"] . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ");\">");
print(str_replace(" ", "&nbsp;", htmlspecialchars($channelInfo["displayname"])));
print("</a>");
print("</td></tr></table>\n");

// Initialize the playercounter for this channel to zero
$counter_playerandsubchannels = 0;

// Loop through all players in the current channel:
foreach($serverInfo["playerlist"] as $playerInfo) {

// Is the current player in the current channel?
if ($playerInfo[channelid] == $channelInfo[channelid]) {

$popupInfo = "Time online: " . $this->_formatTime($playerInfo["totaltime"]) . ", Time idle: " . $this->_formatTime($playerInfo["idletime"]) . ", Ping: " . $playerInfo["pingtime"] . "ms";

// Display player:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
print(str_replace(" ", "&nbsp;", htmlspecialchars($playerInfo["displayname"])));
print("</td></tr></table>\n");

// Increase the player counter:
$counter_playerandsubchannels++;
}
}

// Loop through all channels:
foreach($serverInfo["channellist"] as $subchannelInfo) { if ($subchannelInfo["parent"] == $channelInfo["channelid"]) {
// determine number of players in channel
$currentplayers = 0;
foreach($serverInfo["playerlist"] as $playerInfo) {
if($playerInfo[channelid] == $subchannelInfo["channelid"]) $currentplayers++;
}

$popupInfo = "Max players: " . $subchannelInfo["maxplayers"] . ", Codec: " . $this->_getCodecName($subchannelInfo["codec"]);
if ($subchannelInfo["topic"] != "") { $popupInfo = $popupInfo . ", Topic: " . $subchannelInfo["topic"]; }

// Display channel:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeaksubchannel\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeaksubchannel\" href=\"javascript:enterSubChannel_" . $jsTeamspeakId . "('" . $channelInfo["channelname"] . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ", '" . $subchannelInfo["channelname"] . "');\">");
print(str_replace(" ", "&nbsp;", htmlspecialchars($subchannelInfo[channelname])));
print("</a>");
print("</td></tr></table>\n");

// Initialize the playercounter for this channel to zero
$counter_player = 0;

// Loop through all players in the current channel:
foreach($serverInfo["playerlist"] as $playerInfo) {

// Is the current player in the current channel?
if ($playerInfo[channelid] == $subchannelInfo[channelid]) {

$popupInfo = "Time online: " . $this->_formatTime($playerInfo["totaltime"]) . ", Time idle: " . $this->_formatTime($playerInfo["idletime"]) . ", Ping: " . $playerInfo["pingtime"] . "ms";

// Display player:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_player + 1) == $currentplayers) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
print(str_replace(" ", "&nbsp;", htmlspecialchars($playerInfo["displayname"])));
print("</td></tr></table>\n");

// Increase the player counter:
$counter_player++;
}
}

// Increase the channelcounter
$counter_playerandsubchannels++;
} }

// Increase the channelcounter
$counter++;
} }
}
print("</tr></td></table>");
}
}

// Create an instance of the Teamspeak Display Class
$teamspeakDisplay = new teamspeakDisplayClass;

?>
which produces something like this :



since changing the skin - the text in that TS module is really massive and ugly - I cant find how or where its set via the skin itself so was wondering how could I alter the above script to hardcode font settings to each element ? (ie - servername, channel, subchannel, and username.)

any help greatly appreciated!

--------------- Added [DATE]1204708210[/DATE] at [TIME]1204708210[/TIME] ---------------

this it the solution that the designer came up with years ago -

it dont work though...

https://vborg.vbsupport.ru/showthrea...05#post1456805
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07374 seconds
  • Memory Usage 2,201KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete