How is it possible to achieve something like this but for PB's ?
http://www.lfsforum.net/attach ... tid=3462&d=1132355773
And with the scripts for online/offline all I can get is: Couldn't get hostlist. Click to retry...
I'm using this script
<?
//******************************************
// Add Team Member names to$TeamMembers
// LFS User Name and in lowercase
// Lowercase used to reduce typos
// in the username
//
// Also add the team Members In Game
// Name in $InGameName (any case will do)
// MUST be in the same order as $TeamMembers
//******************************************
$TeamMembers = array("pinto_pt","lfs name","lfs name","lfs name","lfs name");
$InGameName = array("pinto_pt","lfs name","lfs name","lfs name","lfs name");
//**********************************
// function to safely trim null-terminated strings
// could just use trim () in this example though
function trim_c_string ($string) {
$new = "";
$len = strlen ($string);
for ($x=0; $x<$len; $x++) {
if ($string[$x] != "\0") $new .= $string[$x];
else break;
}
return $new;
}
// Function to remove the colour code data from a string
function remove_colour_codes($String){
$ColCodes = array("^0","^1","^2","^3","^4","^5","^6","^7","^8","^9");
$NewString = str_replace($ColCodes, "",$String);
return $NewString;
}
// Function used by format_host_colours function to display correct colour value in html format
function get_colour($ColourNum){
switch ($ColourNum) {
case "0";
$ColourName = "#000000"; //Black
break;
case "1";
$ColourName = "#FF0000"; //Red
break;
case "2";
$ColourName = "#00FF00"; //Pastel Green
break;
case "3";
$ColourName = "#FFFF00"; //Yellow
break;
case "4";
$ColourName = "#0000FF"; //Light Blue
break;
case "5";
$ColourName = "#FF0080"; //Light Purple
break;
case "6";
$ColourName = "#00FFFF"; //Turquoise
break;
case "7";
// Remove comment marks on next line if not a white background
//$ColourName = "#FFFFFF"; //White
// Add Comment marks to next line if not a white background
$ColourName = "#808080"; //Dark Grey
break;
case "8";
$ColourName = "#00FF00"; //Pastel Green
break;
}
return $ColourName;
}
// Function to replace the ^x codes in the Host name to show correct colours on the screen
function format_host_colours($HostName){
for($i = 0; $i < strlen($HostName); $i++){
if(substr($HostName, $i, 1) == "^"){
$CharPos = strpos($HostName, "^", $i);
$ColNum = substr($HostName, strpos($HostName, "^", $i) + 1,1);
$ColourString = get_colour(substr($HostName, strpos($HostName, "^", $i) + 1,1));
if($i == "0"){
// If ^ found at the start of the host string remove the ^[num]
$TmpString = substr($HostName,$i+2);
// Add the html font code to the start of the string and append the
// variable $TmpString with the ^[num] removed
$HostName = "<font color='$ColourString'>".$TmpString;
}
else{
// Get the left part of the string to the next ^[num]
$LTmpString = substr($HostName,0,$i);
// Get the right part of the string after the ^[num]
$RTmpString = substr($HostName,$i+2);
// Add the html close font and add the new html colour to the end of the
// Left part of the string then add the right part of the string
$HostName = $LTmpString."</font><font color='$ColourString'>".$RTmpString;
}
}
}
// Close any html font tag left open in the above
$HostName = $HostName."</font>";
Return $HostName;
}
// Function to display Team Members online in a dynamic table
function display_expandable_table($TeamMembers, $LfsUsers, $InGameName){
// Set the variable to count the members online
$MembersOnline = 0;
// Count the number of members
$TotalMembers = count($TeamMembers);
// Create Header row for the table
echo "<tr bgcolor='#CCCCCC' align='center'><th>Team Racer</th><th>On Server</th></tr>";
// search through the file for Team Members and add a row to the
// table showing the name and server they are on
foreach ($LfsUsers as $LfsUser => $LfsHost) {
for($i = 0; $i < $TotalMembers; $i++){
if(strtolower($LfsUser) == $TeamMembers[$i]){
$LfsUser = remove_colour_codes($LfsUser);
$LfsHost = format_host_colours($LfsHost);
echo "<tr bgcolor='#FFFFFF'>";
echo "<td>$InGameName[$i]</td>";
echo"<td>$LfsHost</td></tr>";
$MembersOnline =+ 1;
}
}
}
// Display this row only if no members are online
if($MembersOnline == 0){
echo "<tr bgcolor='#FFFFFF' align='center'><td>No Members</td><td>Are Online</td></tr>";
}
}
// Function to display all Team Member Status
function display_fixed_table($TeamMembers, $LfsUsers, $InGameName){
/// Count the number of members
$TotalMembers = count($TeamMembers);
// Create Header row for the table
echo "<tr bgcolor='#CCCCCC' align='center'><th>Team Racer</th><th>Status</th><th>On Server</th></tr>";
for($i = 0; $i < $TotalMembers; $i++){
echo "<tr bgcolor='#FFFFFF'>";
foreach ($LfsUsers as $LfsUser => $LfsHost) {
if(strtolower($LfsUser) == $TeamMembers[$i]){
$LfsHost = format_host_colours($LfsHost);
echo "<td>$InGameName[$i]</td>";
echo "<td>Online</td>";
echo"<td>$LfsHost</td></tr>";
$Found = "True";
break;
}
else{
$Found = "False";
}
}
if($Found == "False"){
echo "<td>$InGameName[$i]</td>";
echo "<td>Offline</td>";
echo"<td> </td></tr>";
}
}
}
// init some vars
$LfsUsers = array ();
$x = 0;
$LfsHostList = "";
// get the hostlist
$LfsHostList = file_get_contents ("http://lfsworld.net/pubstat/get_stat2.php?action=hosts");
$len = strlen ($LfsHostList);
// Thanks to Tristiancliffe for this line. It is a refresh link
if ($len < 52) exit ("<a href='javascript:document.location.reload();'>Couldn't get hostlist. Click to retry...</a>");
// parse the data
while ($x < $len) {
$LfsHostName = "";
$nr_racers = 0;
for ($y=0; $y<32; $y++) $LfsHostName .= $LfsHostList[$x++];
$LfsHostName = trim_c_string ($LfsHostName);
$x += 20; // skip some host-data
$nr_racers = ord ($LfsHostList[$x++]);
for ($w=0; $w<$nr_racers; $w++) {
$LfsUserName = "";
for ($y=0; $y<24; $y++) $LfsUserName .= $LfsHostList[$x++];
$LfsUsers[trim_c_string ($LfsUserName)] = $LfsHostName;
}
}
// Create table to hold data
echo "<center><br>";
echo "<table border='1' bordercolor='C0C0C0' cellpadding='4' cellspacing='0' style='border-collapse: collapse' style='font-family: Verdana; font-size: 10pt'>";
//*************************************************
// Comment and Uncomment the type of table you want
//*************************************************
display_expandable_table($TeamMembers, $LfsUsers, $InGameName);
display_fixed_table($TeamMembers, $LfsUsers, $InGameName);
/* Close the table */
echo "</table></center><br>";
?>