You are not logged in.
#1 26 Mar 2007 2:09 pm
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
help
Hi,
i had a problem to resolve the countrycode of an player, with what for a code an i request it? and from what fpr a link ? (getplayerinfo.aspx ....)
and how can i make a 2142 server script ?
i want to query the last played server of a gamer ? it is possible? without a other site like (gamerssearch)?
please help me with my problems,
thx
Offline
#2 26 Mar 2007 3:21 pm
Re: help
several queries show country codes, getleaderboard does, as does getplayerinfo.
as for tracking players history, I don't recall if that is something pulled from the stats databases, I believe bf2142tracker just monitors all the ranked servers, and players that play on them.
Offline
#3 28 Mar 2007 5:54 am
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
hello,
id dont find the code 'countrycode' in all getplayerinfo links ?
please say me the code for country code is it 'contrycode' ? and under which link can i request this ?
Offline
#4 28 Mar 2007 7:23 am
Re: help
hrm... I thought getplayerinfo had the country code, but it looks like just getleaderboard does. it will be stored under the column "countrycode" in the results.
Offline
#5 28 Mar 2007 2:05 pm
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
hello,
and what is the code for the time with bf2142 and the time with NS ?
THX
Offline
#6 28 Mar 2007 2:31 pm
Re: help
getplayerprogress.aspx?auth=$auth&scale=game&mode=ttp will give you the total time played, and I'm assuming there is some way to get the ns time out of that (like some additional query string parameter). I dont know that I've seen that statistic in game (I installed vista a few weeks back and bf2142 plays like shit on it, so I've haven't really played much since then). I have seen it on the ea site, but will have to go back to the server code or ethereal packet sniffer to see if there's some new parameter for that query.
Offline
#7 29 Mar 2007 1:41 am
Re: help
ok, here's how you get it.
1ApRiL from http://www.2142-stats.com gets all the credit for it though.
when you query getplayerinfo mode=base, one of the results is "bp-1" (booster pack 1), if its value "1" then the player owns NS, otherwise (its "0"), they don't.
if they do, then query getplayerinfo mode=map and sum up the values of "mtt-1-10", "mtt-2-10", "mtt-2-11", "mtt-1-12", and "mtt-2-12" to get the total time playing NS. looking at my own stats, it seems as though they leave out mtt's who's value is 0 (I've never played map 2-12 aka Port Bavaria, so mtt-2-12 doesn't show up in the results for my query).
Offline
#8 29 Mar 2007 10:42 am
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
hello,
sry but id don't work correctly
i wrote this code :
<?php
if ( $nameWert['bp-1'] = 0)
{
echo "<img src='ns_off.png'>";
}else {
echo "<img src='ns_on.png'>";
}
?>
so but all players habe the bp-1 = 1.
i test my own account, i never played or have Ns but the code shows up the "1".
also is the query wrong or unstable?
Offline
#9 29 Mar 2007 10:58 am
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
hi,
my fault i forget a "="
greetz
Offline
#11 31 Mar 2007 4:00 am
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
hello,
i need the code for the
- "global ranking"
and for the
- "clan tag"
i search but dont find it.
have you it ?
and a question to the country code, it is stored in getleaderboard but this doesnt help me, i want to have the countrycode for all players thats use my stats script.
i see you have it on your page, also say it please :-)
Last edited by freak (31 Mar 2007 6:42 am)
Offline
#12 31 Mar 2007 9:17 am
Re: help
global rank, and country codes come from leaderboard. I'd recomend you storing users stats in a database, and pulling from there. this way you can keep from hitting IGN everytime someone looks at their stats, and you can cache all the info (like country and global rank) at once by calling all the stats pages.
dont know about the clan tag. I assume its found by monitoring all of the ranked servers. when the player plays on a ranked server, it shows the tag they used last and you can update your database.
Offline
#13 11 Apr 2007 2:09 pm
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
hello madhatter,
i had one question how do you request the "last battle time" and the "recruit date" ?
also how is the code for this 2 requestes?
Greetz
Offline
#15 12 Apr 2007 2:37 am
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
thank you,MadHatter :
getplayerinfo mode=ovr
acdt = recruit date
lgdt = last battle
have a a list of all request and what they request?
Offline
#17 12 Apr 2007 3:09 pm
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
ok i understand .MadHatter :
not a bad idea.
1ApriL did a look up list on bf2tech that has some of these (and what modes its in) but there's not a full listing... and there should be.
i make what i have, and you can then edit it if something is missing
but i had an other problem i made a code thats my script aczept nicks too not only PIDS.
Here is it, but i had much errors....
Can you plaese help by this ?
Code:
$test = "evolution1310"; if ( is_numeric( $pid ) ) { $playerid = trim( $pid ); } elseif ( !is_numeric( $pid ) ){ $zeilen = file('http://stella.prod.gamespy.com/playersearch.aspx?auth=$auth&nick=$test'); foreach ($zeilen as $zeile => $inhalt) { if ( $zeile > "5" && $zeile < ( $zeilen_anzahl -1 ) ) { $exploded = explode(" ", $inhalt); $result_pid = $exploded['1']; $result_nick = $exploded['2']; } if ( isset( $pid_exp ) && is_numeric( $pid_exp ) ) { $playerid = trim( $pid_exp ); } else { exit("Der Nick existiert nicht!"); } }
THX
Last edited by freak (12 Apr 2007 4:18 pm)
Offline
#18 13 Apr 2007 9:46 am
Re: help
here's my php code for gettting the players PID:
Code:
function get_pid($player_nick) { $pid = -1; $search_request = new http_class(); $search_request->timeout = 0; $search_request->data_timeout = 0; $search_request->user_agent="GameSpyHTTP/1.0"; $url = 'http://stella.prod.gamespy.com/playersearch.aspx?auth='.get_auth($pid).'&nick='.$player_nick.'*'; $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 $pid; } if($search_request->content_length_set && $search_request->content_length <= 0) { $search_request->Close(); return $pid; } do { $error=$search_request->ReadReplyBody($body, 4096); $lines = split("\n", $body); $get_data = false; for($i = 5; $i < count($lines); $i++) { $line = $lines[$i]; $pieces = split("\t", $line); for($j = 0; $j < count($pieces); $j++) { $part = $pieces[$j]; if($part == "H") { if($pieces[$j+1] == "pid") { $get_data = true; break; }else { $get_data = false; } } if($part == "D" && $get_data) { $search_request->Close(); $pid = $pieces[$j+1]; break; }else if(part == "$" && $get_data) { $search_request->Close(); break; } } if($pid != -1) break; } }while($error == "" && strlen($body) != 0); $search_request->Close(); return $pid; } ?>
so you could do something like:
Code:
if(!is_numeric($pid)) { $nick = $pid; $pid = get_pid($nick); if($pid == -1) die("no player named $nick"); }
Offline
#19 13 Apr 2007 4:01 pm
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
hello,
thx but this based on your code, i had another.can you help with my posted code?
Offline
#20 13 Apr 2007 5:58 pm
Re: help
well, the sample you posted looks far from complete, but here's what I made of it:
Code:
<?php $pid = "evolution1310"; $auth = get_auth(0); $playerid = -1; if(is_numeric($pid)) { $playerid = trim($pid); } else { $zeilen = file("http://stella.prod.gamespy.com/playersearch.aspx?auth=$auth&nick=$pid"); $uberschriften = explode("\t", $zeilen[5]); if($uberschriften[1] == "pid") { $data = explode("\t", $zeilen[6]); $playerid = intval($data[1]); }else { exit("Der Nick existiert nicht!"); } } if($playerid != -1) { // fortfahren }else { exit("Der Nick existiert nicht!"); } ?>
Offline
#21 14 Apr 2007 1:17 am
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
Hello,
I test it, but it dosnt work. I dont can request the stats whith pid when i put the code in. He dont shows an error but he dont accept nicks an PID. when i use a nick he take the basic pid thats he always usw when the pid is not correct.
when i delete this from the code the script accept pids but no nicks..
$pid="";
$auth = get_auth(0);
when i use this the scipt dosnt take pid and the nick ??
Have you an idea why?
Last edited by freak (14 Apr 2007 2:05 am)
Offline
#22 15 Apr 2007 7:34 pm
Re: help
I assume you accept some parameter in the URL query for your site (something like nick or pid). I would strongly recommend against using either (because if you create an auth token using a PID that does not really exist, this is the information they watch to block your IP address).
the first assumption my code is making is that the parameter in your URL will be named pid. pid could be either the player's nick, or a pid. if(!is_numeric($pid)) then we assume that what was passed in to the URL as the PID was infact the nick. then we look up the PID based on what they entered to the URL. in my code, I verify that playersearch.aspx finds the users name, and if it does not, then $playerid will be -1 and we'll know that there is no such player, or the user typed their name in wrong. if the nick was found, my code takes the first PID that's returned from our query to playersearch.aspx.
the second assumption my code is making is that when you need the PID that your code will use $playerid, not $pid.
this:
$pid = "evolution1310";
$auth = get_auth(0);
$playerid = -1;
is only for understanding the logic of the rest of the code (and not something that I would think that you should keep in your code).
playersearch's auth token does not use a PID (it uses 0 in place of an actual PID), and since you'll be using $playerid instead of $pid when you actually query EA, I'm setting its initial value to -1 so that after we test $pid's value to be numeric, or find the player's actual PID from it, we can determine whether we actually found the players PID or not... If we didn't, then we cannot pull their stats. which is why I posted this code:
Code:
if($playerid != -1) { // fortfahren }else { exit("Der Nick existiert nicht!"); }
at the end of my example.
I don't know that I really understand your issue, or whether you fully understood my response (maybe something is being lost in translation), but hopefully this helps.
Offline
#24 21 Apr 2007 10:07 am
- freak
- Senior Member
- Registered: Mar 2007
- Posts: 32
Re: help
yes i delete it, because i find the problem and it works now fine.
but i want to made a server query script, thats shows me on what for a server the player has played.
gives there something or must i made a new one?
I want to question gamemonitor.com if they allow me to query there data, perhaps they allow it
or not?
Offline