riptide2k
Member
+7|6983|Zurich, Switzerland

chuyskywalker wrote:

The best I *might* be able to do is find out if they are online and pass you a link to the server they are on (eg, a link to game-monitor.com).
If i understand you right, this is all i ever want (just the information on what server the people are currently playing (the link to game-monitor.com would be great) - and if there is no information, i know they are offline right now). That would be amazing!

Oh wait.. how we should do that technically, what's about the 2 hour caching..? Hm, the online thing should be real time (well kind of, as far as i know the free service on GM has a refresh of about 10 minutes)...
Lord_Arkhan
Member
+0|6996

NM156 wrote:

Lord_Arkhan wrote:

Can you put the "next Rank bar" and "Player-Country" in the Code?
I'll see what I can do with the rank bar... The player's country doesn't get included in the XML feed, so I can't provide that.
I can not put the "next Rank Bar" in the script. The Country Banner is included.

Code:

<?php
//ini_set('zlib.output_compression_level', 1);
ob_start("ob_gzhandler");

require('./bf2s-ml.php');

$mlb->debug = true;

$rankmax1 = "150";
$rankmax2 = "500";
$rankmax3 = "800";
$rankmax4 = "2500";
$rankmax5 = "5000";
$rankmax6 = "8000";
$rankmax7 = "20000";
$rankmax8 = "20000";
$rankmax9 = "50000";
$rankmax10 = "50000";
$rankmax11 = "250000";
$rankmax12 = "200000";
$rankmax13 = "500000";

$time = number_format($time/3600, 2);
$spm = number_format($spm, 2);

if ($rank == '0') {
$progress = Round(($score / $rankmax1) * 100, 2) . "%";
} else if ($rank == '1') {
$progress = Round(($score / $rankmax2) * 100, 2) . "%";
} else if ($rank == '2') {
$progress = Round(($score / $rankmax3) * 100, 2) . "%";
} else if ($rank == '3') {
$progress = Round(($score / $rankmax4) * 100, 2) . "%";
} else if ($rank == '4') {
$progress = Round(($score / $rankmax5) * 100, 2) . "%";
} else if ($rank == '5') {
$progress = Round(($score / $rankmax6) * 100, 2) . "%";
} else if ($rank == '6') {
$progress = Round(($score / $rankmax7) * 100, 2) . "%";
} else if ($rank == '7') {
$progress = Round(($score / $rankmax8) * 100, 2) . "%";
} else if ($rank == '8') {
$progress = Round(($score / $rankmax9) * 100, 2) . "%";
} else if ($rank == '9') {
$progress = Round(($score / $rankmax10) * 100, 2) . "%";
} else if ($rank == '10') {
$progress = Round(($score / $rankmax11) * 100, 2) . "%";
} else if ($rank == '11') {
$progress = Round(($score / $rankmax12) * 100, 2) . "%";
} else if ($rank == '12') {
$progress = Round(($score / $rankmax13)  * 100, 2) . "%";
}

$rankkeys = array(
     "0" => "Private",
     "1" => "Private First Class",
     "2" => "Lance Corporal",
     "3" => "Corporal",
     "4" => "Sergeant",
     "5" => "Staff Sergeant",
     "6" => "Gunnery Sergeant",
     "7" => "Master Sergeant",
     "8" => "First Sergeant",
     "9" => "Master Gunnery Sergeant",
    "10" => "Sergeant Major",
    "11" => "Sergeant Major of the Corps",
    "12" => "2nd Lieutenant"
);

    function sec2log($seconds) {
        $h = floor($seconds / 3600);
        $m = floor(($seconds % 3600) / 60);
        $s = floor(($seconds % 3600) % 60);
        $h=sprintf("%02d", $h);
        $m=sprintf("%02d", $m);
        $s=sprintf("%02d", $s);
        return "{$h}:{$m}:{$s}";
    }

?>
<html>
<head>
  <title>BF2XML Stats Leaderboard</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <script type="text/javascript" src="mlb.js" ></script>
  <link rel="stylesheet" href="mbl.css" type="text/css" />
</head>

<body bgcolor="#FFFFFF" leftmargin="0" marginwidth="0">

<?php
    //no more than 64 pid's per request! Anything more than 64 get's ignored...
    //NO NAMES! PID's ONLY!
    //just a bunch(40) of PID's from various EA leader boards. Replace with your own.
    //these all get joined together into a new var, and sent as one string later..
    $PIDlist = array(
        "squad_a" => "44270258,46186163,44133555,49030723,49441703,48156970,49310307,44133555",
        
    );

    //turn the PID's into multi-dimensional arrays, for comparing against the XLM cache, and multiple group tables.
    $squadgroup = array();
    foreach( $PIDlist as $k => $v ) {
        $v = preg_replace('/\s/', '', $v); //strip all whitespaces (jic)
        $grouppid .= $v . ","; //add all pid's into one string for feed
        $squadgroup[$k] = explode(',', $v);
    }
    if( substr($grouppid,-1, 1) == ","); //better check it first
        $grouppid = substr($grouppid,0,strlen($grouppid)-1); //trim off the last comma

    $mlb->get($grouppid); //get raw xml data array
?>


<form name="compare" method="post">
<input type="hidden" name="pid1">
<input type="hidden" name="pid2">
<input type="hidden" name="url">

<p align="center">

<table border="0" cellpadding="0" cellspacing="0" width="60%">
  <tr>
    <td>

      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td align="left"><input type="button" name="redir" value="vergleichen" onClick="setItems_redir();" disabled>&nbsp;&nbsp;Wähle 2 Spieler und vergleiche die Stats!</td>
        </tr>
      </table>

<?php
    $leadercache = $mlb->getList('score'); //only need to call this once, default sort by 'score'
    foreach( $squadgroup as $group => $squad ) { //cycle through each group array
?>
      <table border="0" cellpadding="0" cellspacing="0" id="<?=$group?>" class="leader sortable" width='640'">
        <tr>
          <th style="padding: 0px 6px; text-align: right;" width="16" class="nosort" id="hdr"><img src="images/compare.gif" alt="Player Compare" width="16" height="16" style="border: 0;"/></th>
          <th width="16" class="nosort" id="hdr">&nbsp;</th>
          <th style="padding-left: 4px; text-align: left;" id="hdr"></th>
          <th style="padding-left: 4px; text-align: left;" id="hdr">Spielername</th>
          <th style="padding-: 0px 6px; text-align: right;" id="hdr">Punkte</th>
          <th style="padding: 0px 6px; text-align: right;" id="hdr">Pkt/min</th>
          <th style="padding: 0px 6px; text-align: right;" id="hdr">Spielzeit</th>
          <th style="padding: 0px 6px; text-align: right;" id="hdr">Next Rank</td>
        </tr>
<?php
        foreach( $leadercache as $players ) { //cycle through each sub-array
            if ( in_array($players['PID'], $squad) ) { //verify, else loop
?>
        <tr>
          <td valign="middle" width="16" nowrap><input type="checkbox" name="compare" value="<?=$players['PID']?>" onclick="setItems(this);"></td>
          <td align='center'><img src='images/bf2tracker/CountryIcons/DE.gif'></td>          
          <td valign="middle" width="16" nowrap><img src="images/rank_small_<?=$players['RANK']?>.gif" alt="<?=$rankkeys[$players['RANK']]?>" style="border: 0;"/></td>
          <td valign="middle" width="35%" style="padding-left: 4px; text-align: left;"><a href="<?=$players['LINK']?>" target="_blank"><?=$players['NICK']?></a></td>
          <td align='left'><?=number_format($players['SCORE'], 0, ',', ',')?></td>
          <td align='left'><?=number_format($players['SPM'], 2)?></td>
          <td><?=sec2log($players['TIME'])?></td>
          <td align='left'><img src='images/bar.gif' width='$progress' height='10' alt='$progress - $score'></td> 
        </tr>
<?php
            }
        }
?>
      </table>
      <br />
<?php
    }
?>
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td align="right"><?php echo "Last Update: " . $mlb->cacheage; ?><br /><?php echo "Next Update: " . $mlb->nextrefresh; ?></td>
        </tr>
      </table>

    </td>
  </tr>
</table>
</p><p style="text-align:right;font-size:90%;">Stats powered by <a href="http://www.bf2s.com/" target="blank">BF2S.com</a>&nbsp;&nbsp;<br />
<a href="http://bf2s.com/my-leaderboard.php?pids=44270258,46186163,44133555,49030723,49441703,48156970,49310307,44133555" target="blank">Official Leaderbord</a> by <a href="http://www.bf2s.com/" target="blank">BF2S.com</a>&nbsp;&nbsp;<br><style="text-align:right;font-size:90%;">Script by <a href="http://www.mscwar.com/" target="blank">NM156</a>&nbsp;&nbsp;</p>
</form>
See http://www.bf2-nss.de/include.php?path= … ntentid=47

Please help me
NM156
The H4xor Mod
+161|7064|North Texas

Lord_Arkhan wrote:

Please help me
Give me just a bit more time.. I'm working on something else at the moment. I'll post it here shortly!
Lord_Arkhan
Member
+0|6996
Ok Ok I give you more Time. Sorry I am Hot. Your Script is my Favorit but the Script from aTi|Sanders is not bad. 

If I can help say simply answer.

Oh my English is very Bad.

Here are all Country Banners --> http://www.bf2-nss.de/bf2s/Country.rar

Last edited by Lord_Arkhan (2005-10-25 15:12:08)

aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
Ok if you understand PHP then you will understand this explaination.

I called for all the Arrays and turned them into variables.

$rankmax1 = "150";
$rankmax2 = "500";
$rankmax3 = "800";
$rankmax4 = "2500";
$rankmax5 = "5000";
$rankmax6 = "8000";
$rankmax7 = "20000";
$rankmax8 = "20000";
$rankmax9 = "50000";
$rankmax10 = "50000";
$rankmax11 = "250000";
$rankmax12 = "200000";
$rankmax13 = "500000";

$time = number_format($time/3600, 2);
$spm = number_format($spm, 2);

if ($rank == '0') {
$progress = Round(($score / $rankmax1) * 100, 2) . "%";
} else if ($rank == '1') {
$progress = Round(($score / $rankmax2) * 100, 2) . "%";
} else if ($rank == '2') {
$progress = Round(($score / $rankmax3) * 100, 2) . "%";
} else if ($rank == '3') {
$progress = Round(($score / $rankmax4) * 100, 2) . "%";
} else if ($rank == '4') {
$progress = Round(($score / $rankmax5) * 100, 2) . "%";
} else if ($rank == '5') {
$progress = Round(($score / $rankmax6) * 100, 2) . "%";
} else if ($rank == '6') {
$progress = Round(($score / $rankmax7) * 100, 2) . "%";
} else if ($rank == '7') {
$progress = Round(($score / $rankmax8) * 100, 2) . "%";
} else if ($rank == '8') {
$progress = Round(($score / $rankmax9) * 100, 2) . "%";
} else if ($rank == '9') {
$progress = Round(($score / $rankmax10) * 100, 2) . "%";
} else if ($rank == '10') {
$progress = Round(($score / $rankmax11) * 100, 2) . "%";
} else if ($rank == '11') {
$progress = Round(($score / $rankmax12) * 100, 2) . "%";
} else if ($rank == '12') {
$progress = Round(($score / $rankmax13)  * 100, 2) . "%";
}

Notice in my original script, i called like $time = $stats['TIME'] Basicly making $time the variable for each time i wanted to call that. This goes for $rank $score and so on.

By the way thank you for the polite comment on mine, but it wouldnt be; if not for chuy.

Last edited by aTi|Sanders (2005-10-26 02:53:57)

Lord_Arkhan
Member
+0|6996

aTi|Sanders wrote:

Ok if you understand PHP then you will understand this explaination.

I called for all the Arrays and turned them into variables.

$rankmax1 = "150";
$rankmax2 = "500";
$rankmax3 = "800";
$rankmax4 = "2500";
$rankmax5 = "5000";
$rankmax6 = "8000";
$rankmax7 = "20000";
$rankmax8 = "20000";
$rankmax9 = "50000";
$rankmax10 = "50000";
$rankmax11 = "250000";
$rankmax12 = "200000";
$rankmax13 = "500000";

$time = number_format($time/3600, 2);
$spm = number_format($spm, 2);

if ($rank == '0') {
$progress = Round(($score / $rankmax1) * 100, 2) . "%";
} else if ($rank == '1') {
$progress = Round(($score / $rankmax2) * 100, 2) . "%";
} else if ($rank == '2') {
$progress = Round(($score / $rankmax3) * 100, 2) . "%";
} else if ($rank == '3') {
$progress = Round(($score / $rankmax4) * 100, 2) . "%";
} else if ($rank == '4') {
$progress = Round(($score / $rankmax5) * 100, 2) . "%";
} else if ($rank == '5') {
$progress = Round(($score / $rankmax6) * 100, 2) . "%";
} else if ($rank == '6') {
$progress = Round(($score / $rankmax7) * 100, 2) . "%";
} else if ($rank == '7') {
$progress = Round(($score / $rankmax8) * 100, 2) . "%";
} else if ($rank == '8') {
$progress = Round(($score / $rankmax9) * 100, 2) . "%";
} else if ($rank == '9') {
$progress = Round(($score / $rankmax10) * 100, 2) . "%";
} else if ($rank == '10') {
$progress = Round(($score / $rankmax11) * 100, 2) . "%";
} else if ($rank == '11') {
$progress = Round(($score / $rankmax12) * 100, 2) . "%";
} else if ($rank == '12') {
$progress = Round(($score / $rankmax13)  * 100, 2) . "%";
}

Notice in my original script, i called like $time = $stats['TIME'] Basicly making $time the variable for each time i wanted to call that. This goes for $rank $score and so on.

By the way thank you for the polite comment on mine, but it wouldnt be; if not for chuy.
Here is your Script at Work with a little mod Präfix and Player Country. --> http://www.bf2-nss.de/include.php?path= … ntentid=46

Can you put the % in the "next Rank Bar"?

I am Missing the "Kill/Death Ratio"! Chuy please put it in.

Last edited by Lord_Arkhan (2005-10-26 10:22:54)

midgetspy
Member
+3|7045
Or, you can go:

Code:

$rankscores = Array(150, 500, 800, 2500, 5000, 8000, 20000, 20000, 50000, 50000, 250000, 200000, 500000);
$progress = round(($stats['SCORE']/$rankscores[$stats['RANK']])*100, 2)."%";
*shrug*

Nic

aTi|Sanders wrote:

Ok if you understand PHP then you will understand this explaination.

I called for all the Arrays and turned them into variables.

$rankmax1 = "150";
$rankmax2 = "500";
$rankmax3 = "800";
$rankmax4 = "2500";
$rankmax5 = "5000";
$rankmax6 = "8000";
$rankmax7 = "20000";
$rankmax8 = "20000";
$rankmax9 = "50000";
$rankmax10 = "50000";
$rankmax11 = "250000";
$rankmax12 = "200000";
$rankmax13 = "500000";

$time = number_format($time/3600, 2);
$spm = number_format($spm, 2);

if ($rank == '0') {
$progress = Round(($score / $rankmax1) * 100, 2) . "%";
} else if ($rank == '1') {
$progress = Round(($score / $rankmax2) * 100, 2) . "%";
} else if ($rank == '2') {
$progress = Round(($score / $rankmax3) * 100, 2) . "%";
} else if ($rank == '3') {
$progress = Round(($score / $rankmax4) * 100, 2) . "%";
} else if ($rank == '4') {
$progress = Round(($score / $rankmax5) * 100, 2) . "%";
} else if ($rank == '5') {
$progress = Round(($score / $rankmax6) * 100, 2) . "%";
} else if ($rank == '6') {
$progress = Round(($score / $rankmax7) * 100, 2) . "%";
} else if ($rank == '7') {
$progress = Round(($score / $rankmax8) * 100, 2) . "%";
} else if ($rank == '8') {
$progress = Round(($score / $rankmax9) * 100, 2) . "%";
} else if ($rank == '9') {
$progress = Round(($score / $rankmax10) * 100, 2) . "%";
} else if ($rank == '10') {
$progress = Round(($score / $rankmax11) * 100, 2) . "%";
} else if ($rank == '11') {
$progress = Round(($score / $rankmax12) * 100, 2) . "%";
} else if ($rank == '12') {
$progress = Round(($score / $rankmax13)  * 100, 2) . "%";
}

Notice in my original script, i called like $time = $stats['TIME'] Basicly making $time the variable for each time i wanted to call that. This goes for $rank $score and so on.

By the way thank you for the polite comment on mine, but it wouldnt be; if not for chuy.
aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
notice if you put your mouse over the bar you get score and next rank progress, though i am about to improve next rank bar. I am going to do another code to make it more acurate.

like say if your first sargeant right....

($rankmax8 - $rankmax9) / ($score - $rankmax8) * 100, 2
aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
I just got that working....its great. Though i had a few issues. I was trying to do $score - $rankmax8 in my tests which doing a higher number minus a lower number returns a negative. So i had to rearrange. Took me awhile to figure that out.....Been so long since high school.

New index.php Code

Code:

<html>
<head>
<style type="text/css">
body {font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center}

td {border:0px solid black ;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

div {border:0px solid black;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

a:link {color: #96977D; text-decoration: none}

a:visited {color: #96977D; text-decoration: none}

a:hover {color: #7B7D64; text-decoration: none}

img {border: 0px;}

.c {background: #222222; border-left: 1px solid #3F4032; border-top: 1px solid #3F4032; border-bottom: 1px solid #3F4032}

.c1 {background: #222222; border: 1px solid #3F4032;}

.c2 {background: #39382B; border-left: 1px solid #3F4032; border-bottom: 1px solid #3F4032;}

.c3 {background: #39382B; border: 1px solid #3F4032; border-top: 0px solid #3F4032;}

</style>
<meta http-equiv="Content-Type" content="text/html;">
</head>
<body bgcolor="#303227">

<br>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td class='c' align='center'>Rank</td>
<td class='c' align='left'>Player</td>
<td class='c' align='center'>Score</td>
<td class='c' align='center'>SPM</td>
<td class='c' align='center'>Time</td>
<td class='c1' align='left'>Next Rank</td>
</tr>
<?php

require('./bf2s-mlb.php');

$mlb->debug = true;
$mlb->get('45662349,43360337,46258567');

foreach( $mlb->getList() as $stats )
{
$nick = $stats['NICK'];
$pid = $stats['PID'];
$rank = $stats['RANK'];
$score = $stats['SCORE'];
$spm = $stats['SPM'];
$time = $stats['TIME'];

$rankmax1 = "150";
$rankmax2 = "500";
$rankmax3 = "800";
$rankmax4 = "2500";
$rankmax5 = "5000";
$rankmax6 = "8000";
$rankmax7 = "20000";
$rankmax8 = "20000";
$rankmax9 = "50000";
$rankmax10 = "50000";
$rankmax11 = "250000";
$rankmax12 = "200000";
$rankmax13 = "500000";

$time = number_format($time/3600, 2);
$spm = number_format($spm, 2);

if ($rank == '0') {
$progress = Round(($score / $rankmax1) * 100, 2) . "%";
} else if ($rank == '1') {
$progress = Round(($rankmax1 - $score ) / ($rankmax1 - $rankmax2) * 100, 2) . "%";
} else if ($rank == '2') {
$progress = Round(($rankmax2 - $score ) / ($rankmax2 - $rankmax3) * 100, 2) . "%";
} else if ($rank == '3') {
$progress = Round(($rankmax3 - $score ) / ($rankmax3 - $rankmax4) * 100, 2) . "%";
} else if ($rank == '4') {
$progress = Round(($rankmax4 - $score ) / ($rankmax4 - $rankmax5) * 100, 2) . "%";
} else if ($rank == '5') {
$progress = Round(($rankmax5 - $score ) / ($rankmax5 - $rankmax6) * 100, 2) . "%";
} else if ($rank == '6') {
$progress = Round(($rankmax6 - $score ) / ($rankmax6 - $rankmax7) * 100, 2) . "%";
} else if ($rank == '7') {
$progress = Round(($rankmax7 - $score ) / ($rankmax7 - $rankmax8) * 100, 2) . "%";
} else if ($rank == '8') {
$progress = Round(($rankmax8 - $score ) / ($rankmax8 - $rankmax9) * 100, 2) . "%";
} else if ($rank == '9') {
$progress = Round(($rankmax9 - $score ) / ($rankmax9 - $rankmax10) * 100, 2) . "%";
} else if ($rank == '10') {
$progress = Round(($rankmax10 - $score ) / ($rankmax10 - $rankmax11) * 100, 2) . "%";
} else if ($rank == '11') {
$progress = Round(($rankmax11 - $score ) / ($rankmax11 - $rankmax12) * 100, 2) . "%";
} else if ($rank == '12') {
$progress = Round(($rankmax12 - $score ) / ($rankmax12 - $rankmax13)  * 100, 2) . "%";
}

Echo "<tr>
<td class='c2' width='16' align='center'><img src='images/rank_small_$rank.gif'></td>
<td class='c2' width='124' align='left'><a target='new window' href='http://www.bf2s.com/player/$pid/'>$nick</a></td>
<td class='c2' width='50' align='center'>$score</td>
<td class='c2' width='50' align='center'>$spm</td>
<td class='c2' width='50' align='center'>$time</td>
<td class='c3' width='200' align='left'><img src='images/bar.gif' width='$progress' height='10' alt='$progress - $score'></td>
</tr>";
}
?>
</table>
</td>
</tr>
<tr>
<td>
<div align="right"><?php echo "Last Update: " . $mlb->cacheage; ?><br /><?php echo "Next Update: " . $mlb->nextrefresh; ?></div>
</td>
</td>
</table>
</body>
</html>
its now completly accurate to next rank.

if you check out http://www.ati-gaming.com/bf2stats/index.php and click right to view source. it shows me as 0.19% towards master gunnery and Master Sargeant

Last edited by aTi|Sanders (2005-10-26 14:25:46)

chuyskywalker
Admin
+2,439|7065|"Frisco"

riptide2k wrote:

Oh wait.. how we should do that technically, what's about the 2 hour caching..? Hm, the online thing should be real time (well kind of, as far as i know the free service on GM has a refresh of about 10 minutes)...
Doh, that's right. That's the reason I don't do that. I think that this isn't going to change. Sorry.
midgetspy
Member
+3|7045
Here's the 4-line version:

Code:

<html>
<head>
<style type="text/css">
body {font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center}

td {border:0px solid black ;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

div {border:0px solid black;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

a:link {color: #96977D; text-decoration: none}

a:visited {color: #96977D; text-decoration: none}

a:hover {color: #7B7D64; text-decoration: none}

img {border: 0px;}

.c {background: #222222; border-left: 1px solid #3F4032; border-top: 1px solid #3F4032; border-bottom: 1px solid #3F4032}

.c1 {background: #222222; border: 1px solid #3F4032;}

.c2 {background: #39382B; border-left: 1px solid #3F4032; border-bottom: 1px solid #3F4032;}

.c3 {background: #39382B; border: 1px solid #3F4032; border-top: 0px solid #3F4032;}

</style>
<meta http-equiv="Content-Type" content="text/html;">
</head>
<body bgcolor="#303227">

<br>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td class='c' align='center'>Rank</td>
<td class='c' align='left'>Player</td>
<td class='c' align='center'>Score</td>
<td class='c' align='center'>SPM</td>
<td class='c' align='center'>Time</td>
<td class='c1' align='left'>Next Rank</td>
</tr>
<?php

require('./bf2s-mlb.php');

$mlb->debug = true;
$mlb->get('45662349,43360337,46258567');

foreach( $mlb->getList() as $stats )
{

$rankscores = Array(150, 500, 800, 2500, 5000, 8000, 20000, 20000, 50000, 50000, 250000, 200000, 500000);

$stats['TIME'] = number_format($stats['TIME']/3600, 2);
$stats['SPM'] = number_format($stats['SPM'], 2);

$progress = round( ($stats['RANK'] == 0 ? ($stats['SCORE'] / $rankscores[0]) : ($rankscores[$stats['RANK']-1] - $stats['SCORE']) / ($rankscores[$stats['RANK']-1] - $rankscores[$stats['RANK']])), 2).'%';

?>
<tr>
<td class='c2' width='16' align='center'><img src='images/rank_small_<?=$stats['RANK']?>.gif'></td>
<td class='c2' width='124' align='left'><a target='new window' href='http://www.bf2s.com/player/<?=$stats['PID']?>/'>$nick</a></td>
<td class='c2' width='50' align='center'><?=$stats['SCORE']?></td>
<td class='c2' width='50' align='center'><?=$stats['SPM']?></td>
<td class='c2' width='50' align='center'><?=$stats['TIME']?></td>
<td class='c3' width='200' align='left'><img src='images/bar.gif' width='$progress' height='10' alt='<?=$progress?> - <?=$stats['SCORE']?>'></td>
</tr>
<?
}
?>
</table>
</td>
</tr>
<tr>
<td>
<div align="right">Last Update<?=$mlb->cacheage?><br />Next Update: <?=$mlb->nextrefresh?></div>
</td>
</td>
</table>
</body>
</html>
Nic
aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
I fixed your 2 line version....alot of errors....no afence.

Code:

<html>
<head>
<style type="text/css">
body {font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center}

td {border:0px solid black ;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

div {border:0px solid black;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

a:link {color: #96977D; text-decoration: none}

a:visited {color: #96977D; text-decoration: none}

a:hover {color: #7B7D64; text-decoration: none}

img {border: 0px;}

.c {background: #222222; border-left: 1px solid #3F4032; border-top: 1px solid #3F4032; border-bottom: 1px solid #3F4032}

.c1 {background: #222222; border: 1px solid #3F4032;}

.c2 {background: #39382B; border-left: 1px solid #3F4032; border-bottom: 1px solid #3F4032;}

.c3 {background: #39382B; border: 1px solid #3F4032; border-top: 0px solid #3F4032;}

</style>
<meta http-equiv="Content-Type" content="text/html;">
</head>
<body bgcolor="#303227">

<br>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td class='c' align='center'>Rank</td>
<td class='c' align='left'>Player</td>
<td class='c' align='center'>Score</td>
<td class='c' align='center'>SPM</td>
<td class='c' align='center'>Time</td>
<td class='c1' align='left'>Next Rank</td>
</tr>
<?php

require('./bf2s-mlb.php');

$mlb->debug = true;
$mlb->get('45662349,43360337,46258567');

foreach( $mlb->getList() as $stats )
{

$rankscores = Array(150, 500, 800, 2500, 5000, 8000, 20000, 20000, 50000, 50000, 250000, 200000, 500000);

$stats['TIME'] = number_format($stats['TIME']/3600, 2);
$stats['SPM'] = number_format($stats['SPM'], 2);

$progress = round( ($stats['RANK'] == 0 ? ($stats['SCORE'] / $rankscores[0]) : ($rankscores[$stats['RANK']-1] - $stats['SCORE']) / ($rankscores[$stats['RANK']-1] - $rankscores[$stats['RANK']])) * 100, 2).'%';

?>
<tr>
<td class='c2' width='16' align='center'><img src='images/rank_small_<?=$stats['RANK']?>.gif'></td>
<td class='c2' width='124' align='left'><a target='new window' href='http://www.bf2s.com/player/<?=$stats['PID']?>/'><?=$stats['NICK']?></a></td>
<td class='c2' width='50' align='center'><?=$stats['SCORE']?></td>
<td class='c2' width='50' align='center'><?=$stats['SPM']?></td>
<td class='c2' width='50' align='center'><?=$stats['TIME']?></td>
<td class='c3' width='200' align='left'><img src='images/bar.gif' width='<? echo $progress ?>' height='10' alt='<? echo $progress ?> - <?=$stats['SCORE']?>'></td>
</tr>
<?
}
?>
</table>
</td>
</tr>
<tr>
<td>
<div align="right">Last Update<?=$mlb->cacheage?><br />Next Update: <?=$mlb->nextrefresh?></div>
</td>
</td>
</table>
</body>
</html>
NM156
The H4xor Mod
+161|7064|North Texas
OK Arkhan, here ya go. Sorry I couldn't post it sooner.

Source code: msc-bf2xml.zip
You can view it here: msc-bf2xml

Last edited by NM156 (2006-02-13 12:58:47)

midgetspy
Member
+3|7045

aTi|Sanders wrote:

I fixed your 2 line version....alot of errors....no afence.
None taken, though I wouldn't consider missing *100 "alot of errors" ;-P

Nic
aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
also you used $nick and forgot echo on $progress
aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
I made a few changes in the script includeing not displaying any % over 100 in progress, and i changed the bar to CSS style. Also copy the PID list you fill in and paste it in $listcopy area.

Code:

 <html>
<head>
<style type="text/css">
body {font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center}

td {border:0px solid black ;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

div {border:0px solid black;color: #7B7D64; font: 9px verdana,sans-serif; margin: 0px 0px 0px 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;}

a:link {color: #96977D; text-decoration: none}

a:visited {color: #96977D; text-decoration: none}

a:hover {color: #7B7D64; text-decoration: none}

img {border: 0px;}

.c {background: #222222; border-left: 1px solid #3F4032; border-top: 1px solid #3F4032; border-bottom: 1px solid #3F4032}

.c1 {background: #222222; border: 1px solid #3F4032;}

.c2 {background: #39382B; border-left: 1px solid #3F4032; border-bottom: 1px solid #3F4032;}

.c3 {background: #39382B; border: 1px solid #3F4032; border-top: 0px solid #3F4032;}

.bar { background-color:#3F4032; border-right:0px solid #7B7D64; padding:0; color:#96977D; height:12px; }

.barbackground { background-color:#3F4032; border:1px solid #7B7D64; height:12px; }


</style>
<meta http-equiv="Content-Type" content="text/html;">
</head>
<body bgcolor="#303227">

<br>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td>
<table ecellspacing='0' cellpadding='2' width='490' align='center'>
<tr>
<td class='c' width="16" align='center'>Rank</td>
<td class='c' width="124" align='left'>Player</td>
<td class='c' width="50" align='center'>Score</td>
<td class='c' width="50" align='center'>SPM</td>
<td class='c' width="50" align='center'>Time</td>
<td class='c1' width="200" align='left'>Next Rank</td>
</tr>
<?php

require('./bf2s-mlb.php');

$mlb->debug = true;
$mlb->get('45662349,43360337,46258567');
$listcopy = "45662349,43360337,46258567";

foreach( $mlb->getList() as $stats )
{
$nick = $stats['NICK'];
$pid = $stats['PID'];
$rank = $stats['RANK'];
$score = $stats['SCORE'];
$spm = $stats['SPM'];
$time = $stats['TIME'];

$rankmax1 = "150";
$rankmax2 = "500";
$rankmax3 = "800";
$rankmax4 = "2500";
$rankmax5 = "5000";
$rankmax6 = "8000";
$rankmax7 = "20000";
$rankmax8 = "20000";
$rankmax9 = "50000";
$rankmax10 = "50000";
$rankmax11 = "250000";
$rankmax12 = "200000";
$rankmax13 = "500000";

$time = number_format($time/3600, 2);
$spm = number_format($spm, 2);

if ($rank == '0') {
$progress = Round(($score / $rankmax1) * 100, 2) . "%";
} else if ($rank == '1') {
$progress = Round(($rankmax1 - $score ) / ($rankmax1 - $rankmax2) * 100, 2) . "%";
} else if ($rank == '2') {
$progress = Round(($rankmax2 - $score ) / ($rankmax2 - $rankmax3) * 100, 2) . "%";
} else if ($rank == '3') {
$progress = Round(($rankmax3 - $score ) / ($rankmax3 - $rankmax4) * 100, 2) . "%";
} else if ($rank == '4') {
$progress = Round(($rankmax4 - $score ) / ($rankmax4 - $rankmax5) * 100, 2) . "%";
} else if ($rank == '5') {
$progress = Round(($rankmax5 - $score ) / ($rankmax5 - $rankmax6) * 100, 2) . "%";
} else if ($rank == '6') {
$progress = Round(($rankmax6 - $score ) / ($rankmax6 - $rankmax7) * 100, 2) . "%";
} else if ($rank == '7') {
$progress = Round(($rankmax7 - $score ) / ($rankmax7 - $rankmax8) * 100, 2) . "%";
} else if ($rank == '8') {
$progress = Round(($rankmax8 - $score ) / ($rankmax8 - $rankmax9) * 100, 2) . "%";
} else if ($rank == '9') {
$progress = Round(($rankmax9 - $score ) / ($rankmax9 - $rankmax10) * 100, 2) . "%";
} else if ($rank == '10') {
$progress = Round(($rankmax10 - $score ) / ($rankmax10 - $rankmax11) * 100, 2) . "%";
} else if ($rank == '11') {
$progress = Round(($rankmax11 - $score ) / ($rankmax11 - $rankmax12) * 100, 2) . "%";
} else if ($rank == '12') {
$progress = Round(($rankmax12 - $score ) / ($rankmax12 - $rankmax13)  * 100, 2) . "%";
}

if ($progress < 100) {
$progresswidth = $progress;
} else {
$progresswidth = "100%";
}

Echo "<tr>
<td class='c2' width='16' align='center'><img src='images/rank_small_$rank.gif'></td>
<td class='c2' width='124' align='left'><a href='http://www.bf2s.com/player/$pid/' target='blank'>$nick</a></td>
<td class='c2' width='50' align='center'>$score</td>
<td class='c2' width='50' align='center'>$spm</td>
<td class='c2' width='50' align='center'>$time</td>
<td class='c3' width='200' align='left'><div class='barbackground' width='190'><div class='bar' style='width:$progresswidth;font-size:90%;'>&nbsp;&nbsp;$progresswidth</div></div></div></td>
</tr>";

}
?>
</table>
</td>
</tr>
<tr>
<td>

<div align="center">All Rights Reserved by <a href="http://www.bf2s.com/" target="blank">BF2S.com</a> and its <a href='http://bf2s.com/my-leaderboard.php?pids=<?  echo $listcopy; ?>' target='_blank'> Official Leaderbord</a> Feed. Scripting by <a href="http://www.ati-gaming.com/" target="blank">aTi|Sanders</a>.</p></div>
<div align="right"><?php echo "Last Update: " . $mlb->cacheage; ?><br /><?php echo "Next Update: " . $mlb->nextrefresh; ?></div>
</td>
</td>
</table>
</body>
</html>

Last edited by aTi|Sanders (2005-10-26 19:52:38)

3D-co.GodGirl
Member
+0|6975|Oklahoma
That is really interesting, when will the full package come out like the MSC Clan website?

I am looking foward to your new updates. Love them!
TriggerHappy998
just nothing
+387|7065|-

3D-co.GodGirl wrote:

That is really interesting, when will the full package come out like the MSC Clan website?

I am looking foward to your new updates. Love them!

chuyskywalker wrote:

XML Feed
Grab the leaderboard and put it on your own site via the BF2S MyLeaderBoard XML Feed.

If you run a PHP site, I've already done all the heavy lifting and have put together a PHP API for you to use complete with readme and examples. Other languages, I'm sorry, I didn't have time (nor do I know perl, ruby, python, asp, etc ;p) If you do use one of those other languages and plan on making your own API, please note a few things:

1) Be kind, release it back to the public.
2) Use some sort of caching (mysql, file, whatever)
3) Please, only use PID's with the feed.
4) The PID limit for the XML feed is 64

#2 is super important because the BF2S.com server WILL BLOCK YOU from pulling more than 3 feeds every 6 hours. (Note, that terminology is correct, this means you could pull one feed every two hours, or three different feeds every 6 hours -- either way.)

Links:
- Readme <- seriously, read this if you're going to use it.
- Examples & Examples Source View <- See how easy the PHP API is to use?
- Download
- And an example from the MSC clan of how they use it
I think this is what you are looking for
3D-co.GodGirl
Member
+0|6975|Oklahoma
I tried it but the folder are empty, only got the two .php files. I must have missed since I got many folders in my documents lol. Thank you
NM156
The H4xor Mod
+161|7064|North Texas

3D-co.GodGirl wrote:

I tried it but the folder are empty, only got the two .php files. I must have missed since I got many folders in my documents lol. Thank you
You should save the source code to a new folder. There are sub folders in the archive too. Unzip it in the new folder, and edit the index.php file, and find the code that looks like this:

Code:

    $PIDlist = array(
        "squad_a" => "44652121,44925574,44995752,43908260,57002019,43553234,43408027,46106732,43343379,43821727",
        "squad_b" => "44348846,45157900,45281515,44720156,44019426,23661956,44359893,43819150,44765996,43676920",
        "squad_c" => "45373234,43363779,47417474,45063400,47902804,49096356,44018431,45206773,43508654,44084118",
        "squad_d" => "45215743,44268395,43395171,44359791,43708995,43520105,43356891,45006981,45763262,48289895"
    );
You'll have to put the PID numbers of the players you want to see on your leader board list. If you only want to have one table, remove the lines squad_b, squad_c, squad_d.

I'm assuming you have a web page to upload this code to, correct? If not, you'll need one that supports PHP scripts.
aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
ok, sorry forgot i wasnt giveing all the files.

Do the same thing as the BF2S.com version and CHMOD the cache folder 777.

But here you go. http://www.ati-gaming.com/bf2stats/bf2stats.zip

P.S. i wish i had more data to play with, BUT i do understand chuy's situation with bandwidth and feed issues. Also please leave the link and copyright to BF2S in the script. Remove my name if you want...its not that important to me; its been fun working on this.

Last edited by aTi|Sanders (2005-10-26 21:23:06)

Techtron
Member
+0|6975
Hi all this all looks really nice, but can anyone tell me how to make it working on a Wordpress page?
Btw, im not good at php coding. Some help whould be nice
EDIT: I found  a way to integrate it now, but ill get an error on line 57, the Get bla bla as Stats line, please some help.
EDIT2: This is the error Code that appears -
Warning: Invalid argument supplied for foreach() in /home/htdocs/web959/html/docs/bf2stats/index.php on line 57
u can chek it here http://dt.onlinefungaming.de scroll down!

Last edited by Techtron (2005-10-27 03:33:14)

aTi|Sanders
Hold your Fire, I forgot my gun!
+0|6984
did you upload all the FILES AND FOLDERS? Not just the index man. Also CHMOD 777 the cache.

Another point that should be brought up is that i see your useing a portal. Make sure to have the images folder and cache folder in the main directory. Also put the bf2s-mlb.php file in the main directory.

Last edited by aTi|Sanders (2005-10-27 06:24:22)

Techtron
Member
+0|6975
image and cache folder now in the main Directory, also the bf2s-mlb.php. Modes are given to cache folder still not working
here is a direct link to it http://bf2stats.kilu.de/index.php
Still the same Line 57 Error
Maybe do i have to insert something here - foreach( $mlb->getList() as $stats ) betwen the two () ? And if so, what exactly?

Last edited by Techtron (2005-10-27 07:37:18)

3D-co.GodGirl
Member
+0|6975|Oklahoma
Ok I am going download it and try it, Out of curiousity; why limited bandwidth? Is it because of small webspace or bandwidth from the host? What is your bandwidth? Sorry if this is Off Topic, I'd like to help out more with some stuff like donation & etc to improve better bandwidth. If it relates to hosting space of bandwidth, I use http://www.surpasshosting.com only if it relates to it. They are good and fast.


*Edit*

I am curious if there is way you can like something here: false to put the squad b, c, d  if you don't want to show them instead of deleting them?

Last edited by 3D-co.GodGirl (2005-10-27 08:01:17)

Board footer

Privacy Policy - © 2024 Jeff Minard