TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 06:58:49 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 190
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 84
  • Total: 84

Pulling in high scores from smfarcade into a block. Has anybody tried this?

Started by houston, November 08, 2005, 03:43:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Broc Lee

For those using SMF Arcade 2.0.14.....

Here is the code to make this work  ;D  :up:

require('./Settings.php');

$top = highscore();
//echo "<pre>".print_r($top,true)."</pre>";

foreach($top as $temp){

echo"<table align=\"center\" width=\"100%\"><tr><td align=\"center\" class=\"smalltext\"><b><a href=\"$boardurl/index.php?action=profile;u={$temp['ID_MEMBER']}\">{$temp['realName']}</a></b></td></tr>";
echo "<tr><td align=\"center\"><a href=\"$boardurl/index.php?action=arcade;sa=play;game={$temp['ID_GAME']}\"><img src=\"$boardurl/Games/{$temp['gameDirectory']}/{$temp['thumbnail']}\"></a></td></tr><tr><td align=\"center\" class=\"smalltext\"><a href=\"$boardurl/index.php?action=arcade;sa=play;game={$temp['ID_GAME']}\">{$temp['gameName']}</a> - {$temp['score']}</td></tr><tr><td width=\"100%\"><hr></td></tr></table>";
}
function highscore($count = 5, $game = "", $cutoff = 0)
{
global $link,$db_prefix,$boarddir,$boardurl;

if($game == "")
$query = "SELECT * FROM {$db_prefix}arcade_games,{$db_prefix}arcade_scores,{$db_prefix}members WHERE {$db_prefix}arcade_games.ID_GAME={$db_prefix}arcade_scores.ID_GAME AND {$db_prefix}arcade_scores.ID_MEMBER={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}arcade_games,{$db_prefix}arcade_scores,{$db_prefix}members WHERE {$db_prefix}arcade_games.ID_GAME={$db_prefix}arcade_scores.ID_GAME AND {$db_prefix}arcade_scores.ID_MEMBER={$db_prefix}members.ID_MEMBER AND {$db_prefix}arcade_games.ID_GAME='{$game}' ORDER BY score DESC LIMIT 0,{$count}";
$res = mysql_query($query) or die(mysql_error());
$top = array();
while($x = mysql_fetch_array($res))
{
$x['score'] = (string)$x['score'];
$top[] = $x;

}
return $top;
}


I have also added a thumbnail of the game, a link to the game and a link to the members profile.

Take a look:  http://www.thrillcycle.com/forum/index.php - Left side, under the Search Box.

Enjoy!!!
~Broc


sir_keg1