Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Tyrent
New Member
New Member



Joined: Jan 30, 2006
Posts: 18
Location: orlando FL

PostPosted: Mon Mar 13, 2006 12:11 pm Reply with quote

Shocked I am back ?!?! Ok this is what i am looking for I have ultra stats installed and working stats and live server stats I want to put the live-server into a block I should know this but am drawing a blank can anyone lead me in some direction (but not to the door) thanks

Tyrent

_________________
Some Day I will Learn But Right Now Tweak It,Brains A little Mushy 
View user's profile Send private message Visit poster's website
sting
Involved
Involved



Joined: Sep 23, 2003
Posts: 456
Location: Somewhere out there...

PostPosted: Wed Mar 15, 2006 12:39 pm Reply with quote

Put the feed into a $content variable and load it up as a block. I suggest taking an existing block, peeling it apart and plug and play as you would like. Or post the code for the data you would like to see in the block here and maybe one of us will pick it up and make it happen.

I did say maybe, right?

ok.

-sting

_________________
You see - I told you I wasn't paranoid. They were really out to get me. 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Tyrent







PostPosted: Wed Mar 15, 2006 4:17 pm Reply with quote

This is what I have any help would be great Thanks for your time


<?php
require_once "../include/prepend.php";
require("../include/sof2live.php");

// Begin SERVERLIVESTATS

// Begin General Informations
$content['SERVERIP'] = $CFG['Live_ServerIP'];
$content['SERVERPORT'] = $CFG['Live_ServerPort'];
$content['SERVERNAME'] = $CFG['Live_ServerName'];
// End General Informations


// End SERVERLIVESTATS

// Overwrite Header
$content[HEADER] = "Live Status of the Server";

// Get Serverstats
$oSof2 = new SoldierOfFortune2;
$status = $oSof2->getServerStatus($CFG['Live_ServerIP'],$CFG['Live_ServerPort'],10000);

if ($status)
{
if ($content['SERVERNAME'] == "")
$content['SERVERNAME'] = GetSof2ColorAsHTML($oSof2->m_servervars["sv_hostname"]);
$content['SERVERMAPRUNNING'] = $oSof2->m_servervars["mapname"];

// Check for images
$IMAGEDIR = $CommonBasePath.$projectname."/web/images/level/";

if (!is_file($IMAGEDIR.$oSof2->m_servervars["mapname"].".jpg"))
$content['SERVERMAPPICTURE'] = "no-pic";
else
$content['SERVERMAPPICTURE'] = $oSof2->m_servervars["mapname"];
// Check for images

// Set generic values
$content['PLAYERSCONNECTED'] = $oSof2->m_servervars["sv_currentclients"];
$content['PLAYERSMAX'] = $oSof2->m_servervars["sv_maxclients"];
$content['SERVERDOWNLOAD'] = ($oSof2->m_servervars["sv_allowDownload"] == 1) ? "Yes" : "No";
$content['SERVERPURE'] = ($oSof2->m_servervars["sv_pure"] == 1) ? "Yes" : "No";
$content['SERVERNEEDPASS'] = ($oSof2->m_servervars["g_needpass"] == 1) ? "Yes" : "No";
$content['SERVERSCORELIMIT'] = $oSof2->m_servervars["scorelimit"];


if (strtolower($oSof2->m_servervars["g_gametype"]) != dm)
{
if ($oSof2->blue < $oSof2->red)
$content['TEAMLEADTEXT'] = "Red leads Blue by ".($oSof2->red - $oSof2->blue);
if ($oSof2->blue > $oSof2->red)
$content['TEAMLEADTEXT'] = "Blue leads Red by ".($oSof2->blue - $oSof2->red);
if ($oSof2->blue == $oSof2->red)
$content['TEAMLEADTEXT'] = "Game tied at ".($oSof2->blue)."";

$content['SERVERFRIENDLYFIRE'] = ($oSof2->m_servervars["g_friendlyfire"] == 1) ? "On" : "Off";

$content['BLUETEAM_COUNT'] = $oSof2->totalblue;
$content['BLUETEAM_POINTS'] = $oSof2->blue;
$content['REDTEAM_COUNT'] = $oSof2->totalred;
$content['REDTEAM_POINTS'] = $oSof2->red;

$i=1;
while($oSof2->bluearray[$i][3] <> "")
{
$content['BLUETEAM'][$i][PLAYER_NAME] = GetSof2ColorAsHTML($oSof2->bluearray[$i][3]);
$content['BLUETEAM'][$i][PLAYER_PING] = $oSof2->bluearray[$i][2];
$content['BLUETEAM'][$i][PLAYER_POINTS] = $oSof2->bluearray[$i][1];
$content['BLUETEAM'][$i][PLAYER_XXX] = $oSof2->bluearray[$i][4];

$i++;
}

$i=1;
while($oSof2->redarray[$i][3] <> "")
{
$content['REDTEAM'][$i][PLAYER_NAME] = GetSof2ColorAsHTML($oSof2->redarray[$i][3]);
$content['REDTEAM'][$i][PLAYER_PING] = $oSof2->redarray[$i][2];
$content['REDTEAM'][$i][PLAYER_POINTS] = $oSof2->redarray[$i][1];
$content['REDTEAM'][$i][PLAYER_XXX] = $oSof2->redarray[$i][4];

$i++;
}
}
else
{
$content['DMPLAYERS_COUNT'] = $oSof2->totaldm;

$i=1;
while($oSof2->dmarray[$i][3] <> "")
{
$content['DMPLAYERS'][$i][PLAYER_NAME] = GetSof2ColorAsHTML($oSof2->dmarray[$i][3]);
$content['DMPLAYERS'][$i][PLAYER_PING] = $oSof2->dmarray[$i][2];
$content['DMPLAYERS'][$i][PLAYER_POINTS] = $oSof2->dmarray[$i][1];
$i++;
}
}

// Make SpecArray
$i=1;
while($oSof2->specarray[$i][2] <> "")
{
$content['SPECTATORS'][$i][PLAYER_NAME] = GetSof2ColorAsHTML($oSof2->specarray[$i][2]);
$content['SPECTATORS'][$i][PLAYER_PING] = $oSof2->specarray[$i][1];

$i++;
}



switch ( strtolower($oSof2->m_servervars["g_gametype"]) )
{
case "inf":
$content['SERVERGAMETYPE'] = "Infiltration";
break;
case "ctf":
$content['SERVERGAMETYPE'] = "Capture the Flag";
break;
case "dem":
$content['SERVERGAMETYPE'] = "Demolition";
break;
case "elim":
$content['SERVERGAMETYPE'] = "Elimination";
break;
case "tdm":
$content['SERVERGAMETYPE'] = "Team Deadmatch";
break;
case "dm":
$content['SERVERGAMETYPE'] = "Deadmatch";
break;

//Default case
$content['SERVERGAMETYPE'] = strtolower($oSof2->m_servervars["g_gametype"]);
}

if (strtolower($oSof2->m_servervars["g_gametype"]) == dm)
$page -> parser($content, "server-live-dm.html"); // Parse only | DM Type
else
$page -> parser($content, "server-live-team.html"); // Parse only | All Others
}
else
{
// Parse only
$page -> parser($content, "server-live-off.html");
}

// Output of the html
$page -> output();

?>

confused ????
 
Tyrent







PostPosted: Sun Mar 19, 2006 10:31 am Reply with quote

Looking at this would it be a block or module ?? I will try both I know there was a post on here about this being in a block but no details on how they did it I will continue tweaking it until I get fed up !! (right ) Thanks for the input again
 
sting







PostPosted: Sun Mar 19, 2006 10:26 pm Reply with quote

Quote:

onfused ????


Very. Ha.

When I said throw it into a content variable I suppose I should have qualified that... lol.

First off - when you post code, put it within the [ c o d e ] brackets (no spaces) and end it with the [/ c o d e] (no spaces)... makes it easier to view.

Ok - the way the block works is that you do all of the processing you want inside of it but the actual OUTPUT (what you see on the screen) has to be in the "$content" variable.

SO - if you wanted a list of servers, you would have something similar to the following:
Code:


$content = $server1 . "<BR>"
$content .= $server2 . "<BR>"


This would theoretically view as the name of server 1 and the name of server 2 on 2 separate lines within the block.

The .= indicates that the $content variable is to use whatever was already there and add that to the info that comes next.

So from what you posted all of the $content stuff you have in there shouldn't actually be there - use other variables for all of those and simply put what your output is going to be into $content.

This goes for blocks only - modules you can do whatever you want to do and echo them out using echo to write html and output it within OpenTable() and CloseTable().

Hope this helps.

-sting
 
Tyrent







PostPosted: Mon Mar 20, 2006 8:32 am Reply with quote

Thanks for your help any info helps and I thank you for your time and I will post code as you suggested my bad missed that but learned something new and that is allways a good thing !!! Very Happy
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous 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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©