View Single Post
Dude
Junior Member
Join Date: Dec 2010
Old 01-05-2011 , 06:16   Player steam avatar on stats site (WEB! not game!)
Reply With Quote #1150

Hi all!

I thank the author for this great addition (stats)!

If you want players steamcommunity avatars, ranking etc. on your own stats web site like this:

player php sample

find in player.php this:

PHP Code:
if (mysql_num_rows($result) > 0)
{
    
$playername htmlentities($row['name'], ENT_COMPAT"UTF-8");
    
    
$timesrow mysql_fetch_array(mysql_query("SELECT COUNT(*) AS times FROM " $mysql_tableprefix "timedmaps WHERE steamid = '" $id "'"));
    
$times $timesrow['times']; 
and just after put this code:
PHP Code:
$xml simplexml_load_file('http://steamcommunity.com/profiles/'.getfriendid($row['steamid']).'?xml=1');

foreach (
$xml->avatarMedium as $foo
    {
    
$Avatar "<img src=".$foo."> ";
    }

foreach (
$xml->steamRating as $foo
    {
    
$SRank "</br><small><small><b>Steam Rating:</b> $foo </small></small>";
    }
    
$xml simplexml_load_file('http://steamcommunity.com/profiles/'.getfriendid($row['steamid']).'/stats/L4D2/?xml=1');

foreach (
$xml->stats->lifetime as $foo
    {
    
$TTima "&nbsp;&nbsp;<small><small><b>Total time played:</b> $foo->timeplayed</small></small>";
    }

foreach (
$xml->stats->lifetime as $foo
    {
    
$PHour "&nbsp;&nbsp;<small><small><b>Kills per hour:</b> $foo->killsperhour</small></small>";
    } 

then replace lines:

PHP Code:
    $tpl->set("title""Viewing Player: " $playername); // Window title
    
$tpl->set("page_heading""Viewing Player: " $playername); // Page header 
with this:
PHP Code:
    $tpl->set("title""Viewing Player: " $playername); // Window title
    
$tpl->set("page_heading""" $Avatar $playername $SRank $TTima $PHour); // Page header 
Enjoy!
__________________
Gamers Community: gamesteams.com/Dude.html
Dudeists Steam Gropup server with stats http://left4bowl.clanservers.com

Last edited by Dude; 01-05-2011 at 06:25.
Dude is offline