You are not logged in.

#101 02 Aug 2008 5:31 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

God it's been a long time since I did anything with this script. Madhatter, do you remember what wiki site that had the query information (such as finding nick, pid etc) that the script is based on? Wanna add a simply thingy that colors the name of the player red on the Server Status script if the nick is not equal to the gamespy nick (simplified namespoof checker).

EDIT: Found the link further up, though on a notice, the script is unclean with at least the following:
unexpected T_PRIVATE, expecting ')' in /bf2stats/bf2/defines.php, PRIVATE is a function in PHP5.

Last edited by Butcher (02 Aug 2008 5:57 pm)


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#102 04 Aug 2008 8:26 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

yes, unfortunately I don't work w/ php5 much.  That's an issue quite a few have run into (as well as an index out of range exception that gets thrown as well).  You can get around it by naming it PRIVATE_RANK or something like that in defines.php, and in the script that uses it.

Offline

 

#103 04 Aug 2008 8:51 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Yeah, I'm doing some bugfixes etc on the script. Also including all reachable information, so anyone can toy around with it.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#104 04 Aug 2008 10:18 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Can I use for loops through Smarty by the way? Save a lot of space in the index file for storing Army and Map info.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#105 04 Aug 2008 10:36 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

yea you can.  I've only worked w/ smarty's a little bit (the front end blog uses it), but I know you can do a for loop.  you may want to read up on the documentation for exactly how to use it: http://www.smarty.net/manual/en/languag … oreach.php

Offline

 

#106 04 Aug 2008 10:42 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Any idea if map queries changed? Can't query anything with it, just returns the query name. For example:
If I query ${mwn-101} (Wins on Dalian Plant) for myself, it returns nothing, and it should be 159.

Last edited by Butcher (04 Aug 2008 10:45 am)


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#107 04 Aug 2008 11:12 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

you may want to double check to see that your results actually have map info.

Offline

 

#108 04 Aug 2008 11:26 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

I'll be damned, I dont. I got awards, player and weapons. Do you have a file for map?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#109 04 Aug 2008 12:28 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

not quite sure if the URL's are at the top in the comments on the bf2_player.php file you have, but I think you have to run all 3 url's in order to get all the stats.

for some reason gamespy only lets you run those 3 queries (can't combine them into one big query).  if you run one big one w/ the other query parameters it doesn't return anything.

the one that queries map info is: /ASP/getplayerinfo.aspx?pid=${PID}&info=mtm-,mwn-,mls-

Offline

 

#110 04 Aug 2008 1:49 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Hmm, I see it commented out. There are two references matching:
* /ASP/getplayerinfo.aspx?pid=${PID}&info=ktm-,vtm-,wtm-,mtm-&kit=4&vehicle=0&weapon=2&map=4
* /ASP/getplayerinfo.aspx?pid=${PID}&info=mtm-,mwn-,mls-

Can I add them in a new function like this for example (resampled from the other functions to get data):

Code:

function _get_mapdata() {        
$url = ""http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=${PID}&info=mtm-,mwn-,mls-";
$results = $this->_query_ea($url);

Or does it require deeper implementation?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#111 04 Aug 2008 3:11 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

sure you can do that, though if it were me I'd just tack it on to the end of _get_stats:

Code:

function _get_stats() {        
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
    $results = $this->_query_ea($url);
    $this->stats = $this->_get_result_set($results);    
    $url = "http://BF2Web.gamespy.com//ASP/getplayerinfo.aspx?pid".$this->_pid."&info=mtm-,mwn-,mls-";
    $results = $this->_query_ea($url);
    $map_info = $this->_get_result_set($results);
    array_merge($this->stats, $map_info);
    $url = "";        
}

whatever you do, make sure  you don't overwrite $this->stats, use something that appends the array like array_merge (though array_merge is probably slower than array_push, but I don't know whether the behavior of that will append an array to an element of stats or if it will append the resultant array of map info to stats).

Offline

 

#112 05 Aug 2008 9:30 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Hmmm, I added it, but still no map info. Does not parse the Smarty tags. Looks like this now:

Code:

function _get_stats() {        
$url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
$results = $this->_query_ea($url);
$this->stats = $this->_get_result_set($results);
$url = "http://BF2Web.gamespy.com//ASP/getplayerinfo.aspx?pid".$this->_pid."&info=mtm-,mwn-,mls-";
$results = $this->_query_ea($url);
$map_info = $this->_get_result_set($results);
array_merge($this->stats, $map_info);
$url = "";
}

Last edited by Butcher (05 Aug 2008 9:38 am)


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#113 05 Aug 2008 9:43 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

you can debug the class to see whats going wrong.  to do that, simply make a php file, instantiate the class, and call print_r($bf2_player->stats) (may want to wrap that inside a <pre></pre> block).

if you end up with map info in there, make sure the key matches your smarty code.  the smarty tag may not be able to use dashes in the key names, so you probably want to verify that as well.

Offline

 

#114 05 Aug 2008 9:50 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Fatal error: Using $this when not in object context in /home/bambooco/public_html/bf2stats/test.php on line 3

Fatal even, poor thing is dying lol. This was without using <pre></pre>, line 3 is the $url = line. Not really sure what he means with it, but he doesn't seem to like it that we are trying to put the PID in there.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#115 05 Aug 2008 3:53 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

post your code.  you can only use $this inside class functions.  if you use it external to the class, you'll get that error.  reason being is that you have the actual pointer to the instance ($bf2_player) and don't need the this pointer.

your code should look something like this:

Code:

<?php

$bf2_player = new bf2_player("[oink]_madhatter");
echo "<pre>";
print_r($bf2_player->stats);
echo "</pre>";

?>

assuming that you've wired in pulling the map info to the constructor of bf2_player.

Offline

 

#116 06 Aug 2008 9:15 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Ok, now doing the following:
test.php: (Active with [oink]_madhatter)
http://www.bamboocommandos.com/bf2stats/test.php

bf2_player.php:

Code:

<?php
/* A class that loads a players stats, awards and other info
 *
 * 
 * /ASP/getplayerinfo.aspx?pid=${PID}&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-
 * /ASP/getplayerinfo.aspx?pid=${PID}&info=ktm-,vtm-,wtm-,mtm-&kit=4&vehicle=0&weapon=2&map=4
 * /ASP/getplayerinfo.aspx?pid=${PID}&info=mtm-,mwn-,mls-
 * /ASP/getunlocksinfo.aspx?pid=${PID}
 * /ASP/getrankinfo.aspx?pid=${PID}
 * /ASP/getbackendinfo.aspx
 * /ASP/getawardsinfo.aspx?pid=${PID}
 */
class bf2_player {
    var $_pid = 0;
    var $_nick = false;
    /*
     * @var array an associative array containing the players stats
     * @access public
     */
    var $stats = array();
    /* 
     * @var bf2_weapons_map an associative array containing a list of weapons and their lock / unlock status
     * @access public
     */
    var $unlocks;
    /*
     * @var bf2_award_map lists the players awards
     */
    var $awards;
    /*
     * @var boolean tells whether we were able to load the players info.
     */
    var $is_valid_player = false;
    function bf2_player($resource=false) {                
        require_once("lib/http.php");
        require_once("bf2_weapon.php");
        require_once("bf2_weapon_map.php");
        require_once("bf2_award_info.php");
        require_once("bf2_award_map.php");
        
        if(!$resource) return;
        
        if(!intval($resource)) {
            $this->_nick = $resource;
            $this->_get_pid();
        } else {
            $this->_pid = intval($resource);
        }
        $this->is_valid_player = $this->_pid > 0;
        if($this->is_valid_player) {
            $this->unlocks = new bf2_weapons_map();
            $this->_get_stats();
            //$this->_get_unlocks();
            //$this->_get_awards();
        }
    }
    function _get_stats() {        
        $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
        $results = $this->_query_ea($url);
        $this->stats = $this->_get_result_set($results);
        $url = "http://BF2Web.gamespy.com//ASP/getplayerinfo.aspx?pid".$this->_pid."&info=mtm-,mwn-,mls-";
    $results = $this->_query_ea($url);
    $map_info = $this->_get_result_set($results);
    array_merge($this->stats, $map_info);
        $url = "";    
    }
    
    function _get_unlocks() {
//        $bed = "";
//        $this->_map_backend_data($bed);
//        $url = "http://BF2Web.gamespy.com/ASP/getunlocksinfo.aspx?pid=".$this->_pid;
    }
    function _get_awards() {
        $url = "http://bf2web.gamespy.com/ASP/getawardsinfo.aspx?pid=".$this->_pid;
        $response = $this->_query_ea($url);
        $this->_build_awards($response);
    }
    function _get_pid() {
        $url = "http://BF2Web.gamespy.com/ASP/searchforplayers.aspx?where=x&nick=".$this->_nick;
        $response = $this->_query_ea($url);
            $result = $this->_get_result_set($response);
            if(isset($result)) {
                $this->_pid = $result['pid'];
                $this->_nick = $result['nick'];
            }else {
                $this->_pid = -1;
            }
    }
    function _map_backend_data($str) {
            /*  CURRENT WEAPON LIST REPORT
                H    id    kit    name    descr
                D    11    0    Chsht_protecta    Protecta shotgun with slugs
                D    22    1    Usrif_g3a3    H&K G3
                D    33    2    USSHT_Jackhammer    Jackhammer shotgun
                D    44    3    Usrif_sa80    SA-80
                D    55    4    Usrif_g36c    G36C
                D    66    5    RULMG_PKM    PKM
                D    77    6    USSNI_M95_Barret    Barret M82A2 (.50 cal rifle)
                D    88    1    sasrif_fn2000    FN2000
                D    99    2    sasrif_mp7    MP-7
                D    111    3    sasrif_g36e    G36E
                D    222    4    usrif_fnscarl    FN SCAR - L
                D    333    5    sasrif_mg36    MG36
                D    444    0    eurif_fnp90    P90
                D    555    6    gbrif_l96a1    L96A2                
            */
        $lines = explode("\n", $str);
        $results = array();
        $line_count = count($lines);
        $line_num = 0;
        $stats = array();
        while ($line_num < $line_count) {
            $next_line = $line_num + 1;
            $line_one = explode("\t", $lines[$line_num]);
            $len = count($line_one);
            if($line_one[0] == '$') {
                break;
            }
            if($line_one[0] == 'O') {
                    $line_num++;
                    continue;
            }
            if($line_one[0] == 'H') {
                $line_two = explode('    ', $lines[$next_line]);
                $line_two_len = count($line_two);
                if($line_two_len > 0 && $line_two[0] == 'D') {                
                    for($index = 1; $index <= $len; $index++) {
                        if(isset($line_one[$index])) {
                            $results[$line_one[$index]] = trim($line_two[$index]);
                        }
                    }
                }else {
                    $line_num++;
                    continue;
                }
            }
            $line_num+=2;
        }
        return $results;
    }
    function _query_ea($url) {       
        $search_request = new http_class();
        $search_request->timeout = 0;
        $search_request->data_timeout = 0;
        $search_request->user_agent="GameSpyHTTP/1.0";
        $args = null;
        $error = $search_request->GetRequestArguments($url, $args);
        if($error != "") {
            $search_request->Close();
            return -1;
        }    
        $error = $search_request->Open($args);
        flush();
        if($error != "") {
            $search_request->Close();
            return -1;
        }
        $search_request->SendRequest($args);
        flush();
        $headers = array();
        $search_request->ReadReplyHeaders($headers);
        if($search_request->response_status != "200") {
            $search_request->Close();
            return -1;
        }
        if($search_request->content_length_set && $search_request->content_length <= 0) {
            $search_request->Close();
            return -1;
        }
        $body = false;
        do {
            $buffer = 0;
            $error=$search_request->ReadReplyBody($buffer, 4096);
            $body .= $buffer;
        }while($error == ""    && strlen($buffer) != 0);
        $search_request->Close();
        return $body;        
    }
    function _get_result_set($str) {
        $lines = explode("\n", $str);
        $results = array();
        $line_count = count($lines);
        $line_num = 0;
        $stats = array();
        while ($line_num < $line_count) {
            $next_line = $line_num + 1;
            $line_one = explode("\t", $lines[$line_num]);
            $len = count($line_one);
            if($line_one[0] != '$') {
                if($line_one[0] == 'O') {
                    $line_num++;
                    continue;
                }
                else if($line_one[0] == 'H') {
                    $line_two = explode('    ', $lines[$next_line]);
                    $line_two_len = count($line_two);
                    if($line_two_len > 0 && $line_two[0] == 'D') {                
                        for($index = 1; $index <= $len; $index++) {
                            if(isset($line_one[$index])) {
                                $results[$line_one[$index]] = trim($line_two[$index]);
                            }
                        }
                    }else {
                        $line_num++;
                        continue;
                    }
                }
                $line_num+=2;
            }else {
                break;
            }
        }
        return $results;
    }
    function _build_awards($str) {
        $awards_map = new bf2_award_map();
        $lines = explode("\n", $str);
        $results = array();
        $line_count = count($lines);
        $line_num = 0;
        $stats = array();
        while ($line_num < $line_count) {
            $next_line = $line_num + 1;
            $line_one = explode("\t", $lines[$line_num]);
            $len = count($line_one);            
            if($line_one[0] == 'O') {
                $line_num++;
                continue;
            } else if($line_one[0] == 'H') {
            } else if($line_one[0] == '$') {
                break;
            }
            $line_num++;
                
        }
        return $results;
    }
}


?>

It posts no reference to mtm-, which is included in the appendment of the $url variable, and through my logic (thats a new one, doing it logically) it should, as he managed to post everything else, except my homemade stuff (calculations between variables stored in index.php).


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#117 06 Aug 2008 11:36 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

ok, found the issues.

first, the url was incorrect.  the pid parameter on the url was missing an '=' between pid and the actual pid, so gamespy didn't do anything

Second, array_merge returns the merged array, so you'd have to do

$this->stats = array_merge(...);

so here's the modified _get_stats function that works:

Code:

function _get_stats() {        
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
    $results = $this->_query_ea($url);
    $this->stats = $this->_get_result_set($results);   
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=mtm-,mwn-,mls-";
    $results = $this->_query_ea($url);
    $map_info = $this->_get_result_set($results);
    $this->stats = array_merge($this->stats, $map_info);
    $url = "";        
}

Offline

 

#118 06 Aug 2008 12:12 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Yeah, I get them parsed now. Tough, Highway Tampa (the crappy map), actually doesnt parse any variables (using 602 as its designator, as specified in the manual). Few issues tough, when I try to do the "All stats for this map", mbr-,mwn-,mls-,mtm-,mcm-,mic-, none of them parse. Is there limitations to how many map stats I can get from one query?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#119 06 Aug 2008 12:45 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

I think it depends on the player's account.  if I haven't played highway tampa (which I haven't in bf2), I don't think it returns any results from the query for that map.

Offline

 

#120 06 Aug 2008 1:02 pm

winsr
Extreme Member
Registered: Mar 2007
Posts: 90

Re: BF2 Rank

true, same applies for BF2142. If you havent played it, info wont show at all for that map, not even with zeros on it...

Offline

 

#121 06 Aug 2008 1:16 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Well I have played it (queried myself for it), but the variable parses as its smart tag. Well, Highway Tampa is crap and I really dont bother showing it anyway, its just a lot of Intel commericals on posters anyway. More important is the general map info (other than the ones I got working), which for some reason aint parsing.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#122 06 Aug 2008 1:33 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

there are a couple of ways around that.  one would be to see if smarty has a test method that can check to see whether the element in the array exists, and if not, just replace the tag value w/ a zero.  the other way would be to pre-fill the stats array with all the stats keys that you'll request:

Code:

// ... $url = ...
$stats_keys = array("mtm-0", "mtm-1", ...);
foreach($stats_keys as $k) {
    $this->stats[$k] = 0;
}
$results = $this->_query_ea($url);
$this->stats = array_merge($this->stats, $this->_get_result_set($results));
// ... $url = ... $map_info = ...
$this->stats = array_merge($this->stats, $map_info)
// ...

that way, when the query comes back w/ info for each element, they'll get updated w/ the array merge (at least I think thats the behavior of array_merge, if not you'll just have to loop over the results yourself and update the array) otherwise, they'll just have a zero value.

Offline

 

#123 07 Aug 2008 9:52 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Hmm, think I got a little bit confused there, I cooked up this:

Code:

function _get_stats() {        
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
    $results = $this->_query_ea($url);
    $this->stats = $this->_get_result_set($results);
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=mtm-,mwn-,mls-";
    $results = $this->_query_ea($url);
    $map_info = $this->_get_result_set($results);
    $this->stats = array_merge($this->stats, $map_info);    
$url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=mtm-,mwn-,mls-";
$stats_keys = array("mbr-0", "mbr-1", "mbr-2", "mbr-3", "mbr-4", "mbr-5", "mbr-6", "mbr-12", "mbr-100", "mbr-101", "mbr-102", "mbr-103", "mbr-105", "mbr-300", "mbr-301", "mbr-302", "mbr-303", "mbr-304", "mbr-305", "mbr-306", "mbr-307", "mbr-601", "mbr-602", "mwn-0", "mwn-1", "mwn-2", "mwn-3", "mwn-4", "mwn-5", "mwn-12", "mwn-100", "mwn-101", "mwn-102", "mwn-103", "mwn-105", "mwn-300", "mwn-301", "mwn-302", "mwn-303", "mwn-304", "mwn-305", "mwn-306", "mwn-307", "mwn-601", "mwn-602", "mls-0", "mls-1", "mls-2", "mls-3", "mls-4", "mls-5", "mls-12", "mls-100", "mls-101", "mls-102", "mls-103", "mls-105",  "mls-300", "mls-301", "mls-302", "mls-303", "mls-304", "mls-305", "mls-306", "mls-307", "mls-601", "mls-602", "mtm-0", "mtm-1", "mtm-2", "mtm-3", "mtm-4", "mtm-5", "mtm-12", "mtm-100", "mtm-101", "mtm-102", "mtm-103", "mtm-105",  "mtm-300", "mtm-301", "mtm-302", "mtm-303", "mtm-304", "mtm-305", "mtm-306", "mtm-307", "mtm-601", "mtm-602", "mcm-0", "mcm-1", "mcm-2", "mcm-3", "mcm-4", "mcm-5", "mcm-12", "mcm-100", "mcm-101", "mcm-102", "mcm-103", "mcm-105", "mcm-300", "mcm-301", "mcm-302", "mcm-303", "mcm-304", "mcm-305", "mcm-306", "mcm-307", "mcm-601", "mcm-602", "mic-0", "mic-1", "mic-2", "mic-3", "mic-4", "mic-5", "mic-12", "mic-100", "mic-101", "mic-102", "mic-103", "mic-105", "mic-300", "mic-301", "mic-302", "mic-303", "mic-304", "mic-305", "mic-306", "mic-307", "mic-601", "mic-602");
foreach($stats_keys as $k) {
    $this->stats[$k] = 0;
}
$results = $this->_query_ea($url);
$this->stats = array_merge($this->stats, $this->_get_result_set($results));
$this->stats = array_merge($this->stats, $map_info)
$url = "";
}

But something tells me I did something wrong with it, regarding parsing these stats variables and outputting them. Shouldn't it be $url = the array?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#124 07 Aug 2008 10:00 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: BF2 Rank

close, but you're getting standard stats, then map stats, then overwriting all the map stats w/ 0, then querying map stats again, and merging it in, then merging the old map results in again.

here's what I think it should look like:

Code:

function _get_stats() {        
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=per*,cmb*,twsc,cpcp,cacp,dfcp,kila,heal,rviv,rsup,rpar,tgte,dkas,dsab,cdsc,rank,cmsc,kick,kill,deth,suic,ospm,klpm,klpr,dtpr,bksk,wdsk,bbrs,tcdr,ban,dtpm,lbtl,osaa,vrk,tsql,tsqm,tlwf,mvks,vmks,mvn*,vmr*,fkit,fmap,fveh,fwea,wtm-,wkl-,wdt-,wac-,wkd-,vtm-,vkl-,vdt-,vkd-,vkr-,atm-,awn-,alo-,abr-,ktm-,kkl-,kdt-,kkd-";
    $results = $this->_query_ea($url);
    $this->stats = $this->_get_result_set($results);    
    $stats_keys = array("mbr-0", "mbr-1", "mbr-2", "mbr-3", "mbr-4", "mbr-5", "mbr-6", "mbr-12", "mbr-100", "mbr-101", "mbr-102", "mbr-103", "mbr-105", "mbr-300", "mbr-301", "mbr-302", "mbr-303", "mbr-304", "mbr-305", "mbr-306", "mbr-307", "mbr-601", "mbr-602", "mwn-0", "mwn-1", "mwn-2", "mwn-3", "mwn-4", "mwn-5", "mwn-12", "mwn-100", "mwn-101", "mwn-102", "mwn-103", "mwn-105", "mwn-300", "mwn-301", "mwn-302", "mwn-303", "mwn-304", "mwn-305", "mwn-306", "mwn-307", "mwn-601", "mwn-602", "mls-0", "mls-1", "mls-2", "mls-3", "mls-4", "mls-5", "mls-12", "mls-100", "mls-101", "mls-102", "mls-103", "mls-105",  "mls-300", "mls-301", "mls-302", "mls-303", "mls-304", "mls-305", "mls-306", "mls-307", "mls-601", "mls-602", "mtm-0", "mtm-1", "mtm-2", "mtm-3", "mtm-4", "mtm-5", "mtm-12", "mtm-100", "mtm-101", "mtm-102", "mtm-103", "mtm-105",  "mtm-300", "mtm-301", "mtm-302", "mtm-303", "mtm-304", "mtm-305", "mtm-306", "mtm-307", "mtm-601", "mtm-602", "mcm-0", "mcm-1", "mcm-2", "mcm-3", "mcm-4", "mcm-5", "mcm-12", "mcm-100", "mcm-101", "mcm-102", "mcm-103", "mcm-105", "mcm-300", "mcm-301", "mcm-302", "mcm-303", "mcm-304", "mcm-305", "mcm-306", "mcm-307", "mcm-601", "mcm-602", "mic-0", "mic-1", "mic-2", "mic-3", "mic-4", "mic-5", "mic-12", "mic-100", "mic-101", "mic-102", "mic-103", "mic-105", "mic-300", "mic-301", "mic-302", "mic-303", "mic-304", "mic-305", "mic-306", "mic-307", "mic-601", "mic-602");
    foreach($stats_keys as $k) {
        $this->stats[$k] = 0;
    }
    $url = "http://BF2Web.gamespy.com/ASP/getplayerinfo.aspx?pid=".$this->_pid."&info=mtm-,mwn-,mls-";
    $results = $this->_query_ea($url);
    $map_info = $this->_get_result_set($results);
    $this->stats = array_merge($this->stats, $map_info);
    $url = "";
}

Offline

 

#125 07 Aug 2008 10:40 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: BF2 Rank

Hmm, thats funny; it gives me all the variables in http://www.bamboocommandos.com/bf2stats/test.php, but all newly added map variables return as 0, rather than it's actual value.


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 



© 2003 - 2024 NullFX
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License