Will only work for SMF arcade, not E arcade
put this code in a center php block or artical
demo
http://sleepy-arcade.ath.cx/dev/portal.php
right at the bottom
function hof($count = 10, $time = - 1)
{
global $db_prefix, $scripturl, $txt, $modSettings;
$where = '';
if ($time == 'current')
$where = 'AND championTo = 0';
elseif ($time != -1)
$where = "AND championFrom > $time";
$results = db_query("
SELECT game.ID_GAME, game.gameName,game.thumbnail, game.gameDirectory, score.score, score.position,
IF(championFrom > 0, (IF(championTo = 0, UNIX_TIMESTAMP(), championTo) - championFrom), 0) AS championDuration,
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName, '') AS realName, IF(championTo = 0, 1, 0) AS current
FROM ({$db_prefix}arcade_scores AS score, {$db_prefix}arcade_games AS game)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
WHERE game.ID_GAME = score.ID_GAME
$where
HAVING championDuration > 0
ORDER BY IF(championFrom > 0, (IF(championTo = 0, UNIX_TIMESTAMP(), championTo) - championFrom), 0) DESC
LIMIT $count", __FILE__, __LINE__);
$top = array();
$max = -1;
while ($score = mysql_fetch_assoc($results))
{
if ($max == -1)
$max = $score['championDuration'];
$top[] = array(
'game_name' => $score['gameName'],
'game_link' => '<a href="' . $scripturl . '?action=arcade;sa=play;game=' . $score['ID_GAME'] . '">' . $score['gameName'] . '</a>',
'member_name' => $score['realName'],
'member_link' => !empty($score['realName']) ? '<a href="' . $scripturl . '?action=profile;u=' . $score['ID_MEMBER'] . '">' . $score['realName'] . '</a>' : $txt['arcade_guest'],
'duration' => format_time_ago($score['championDuration']),
'precent' => ($score['championDuration'] / $max) * 100,
'current' => $score['current'] == 1,
'thumbnail' =>$score['gameDirectory']."/".$score['thumbnail'],
'score' => round($score['score'],3),
);
}
if (count($top) == 0)
return false;
elseif ($count > 1)
return $top;
else
return $top[0];
}
global $scripturl, $txt, $boardurl, $context, $settings, $arcsettings;
$top_player = hof(10);
$i=0; //players position
echo '
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="20%" align="center" nowrap class="titlebg">
<b>Champion in Game</b>
</td>
<td width="25%" align="center" nowrap class="titlebg">
<b>Champions Name</b>
</td>
<td width="15%" align="center" nowrap class="titlebg">
<b>High Score</b>
</td>
<td width="20%" align="center" nowrap class="titlebg">
<b>Champion Since</b>
</td>
</tr>
</table>';
foreach ($top_player as $row)
{
echo '
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td align="left" width="20%" class="windowbg">
<img src="',$boardurl,'/','Games',$row['gameDirectory']."/".$row['thumbnail'],'"></a> ', $row['game_link'],'<br/>
</td>
<td align="center" width="25%" nowrap class="windowbg2">
', $row['member_link'],'
</td>
<td align="center" width="15%" nowrap="nocrap" class="windowbg">
', $row['score'],'
</td>
<td align="center" width="20%" class="windowbg2">
', $row['duration'],'
</td>
</tr>
';
$i++;
}
echo '
</table>';
to cahnge the ammount of players shown
change
$top_player = hof(10);
the ten to the desired number
and
change
function hof($count = 10, $time = - 1)
the tem to you desired number
then open up modifactions.english.php
and add these
$txt['arcade_secs'] = 'seconds';
$txt['arcade_weeks'] = 'weeks';
$txt['arcade_days'] = 'days';
$txt['arcade_hours'] = 'hours';
$txt['arcade_mins'] = 'minutes';
enjoy
Heya
I added this to an article and got the following error:
QuoteFatal error: Call to undefined function: format_time_ago() in /homepages/24/d92034484/htdocs/sub_ryzom/forum/Sources/Load.php(1746) : eval()'d code(209) : eval()'d code on line 37
what arcade are you using it with i never actualy tryed an artical :D i just assumed itll work cos the block does
if you want a hall of fame i have a mod for the arcade that will give you a hof here
http://sleepy-arcade.ath.cx/dev/portal.php?topic=144.0
demo
http://sleepy-arcade.ath.cx/dev/portal.php?action=arcade;sa=hof
Doesnt work in SMF 1.1.6 and TP 1.0.5 and EArcade 2.5.4
and i tried php, script and html blocs. it dont work.
should be strictly clear in these bloc post snippets exactly what version they work with so folks dont try everything... when everything to dont work with anything.
The bloc codes really need to be cleaned up and organized.
E Arcade and SMF arcade are diffrent, so as the code in this post are for SMF Arcade the code will not work in E arcade
I added this info to the first post
thanks g6
ill wip up earcade version :)
ok hers earcade version
function hof($count = 10, $time = - 1)
{
global $db_prefix, $scripturl, $txt, $modSettings;
$where = '';
if ($time == 'current')
$where = 'AND championTo = 0';
elseif ($time != -1)
$where = "AND championFrom > $time";
$results = db_query("
SELECT game.id_game, game.game_name, game.thumbnail, game.game_directory,
IF(champion_from > 0, (IF(champion_to = 0, UNIX_TIMESTAMP(), champion_to) - champion_from), 0) AS championDuration,
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName, '') AS realName, IF(champion_to = 0, 1, 0) AS current
FROM ({$db_prefix}arcade_scores AS score, {$db_prefix}arcade_games AS game)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
WHERE game.ID_GAME = score.ID_GAME
$where
HAVING championDuration > 0
ORDER BY IF(champion_From > 0, (IF(champion_To = 0, UNIX_TIMESTAMP(), champion_To) - champion_From), 0) DESC
LIMIT $count", __FILE__, __LINE__);
$top = array();
$max = -1;
while ($score = mysql_fetch_assoc($results))
{
if ($max == -1)
$max = $score['championDuration'];
$top[] = array(
'game_name' => $score['gameName'],
'game_link' => '<a href="' . $scripturl . '?action=arcade;sa=play;game=' . $score['ID_GAME'] . '">' . $score['gameName'] . '</a>',
'member_name' => $score['realName'],
'member_link' => !empty($score['realName']) ? '<a href="' . $scripturl . '?action=profile;u=' . $score['ID_MEMBER'] . '">' . $score['realName'] . '</a>' : $txt['arcade_guest'],
'duration' => format_time_ago($score['championDuration']),
'precent' => ($score['championDuration'] / $max) * 100,
'current' => $score['current'] == 1,
'thumbnail' =>$score['gameDirectory']."/".$score['thumbnail'],
'score' => round($score['score'],3),
);
}
if (count($top) == 0)
return false;
elseif ($count > 1)
return $top;
else
return $top[0];
}
global $scripturl, $txt, $boardurl, $context, $settings, $arcsettings;
$top_player = hof(10);
$i=0; //players position
echo '
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="20%" align="center" nowrap class="titlebg">
<b>Champion in Game</b>
</td>
<td width="25%" align="center" nowrap class="titlebg">
<b>Champions Name</b>
</td>
<td width="15%" align="center" nowrap class="titlebg">
<b>High Score</b>
</td>
<td width="20%" align="center" nowrap class="titlebg">
<b>Champion Since</b>
</td>
</tr>
</table>';
foreach ($top_player as $row)
{
echo '
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td align="left" width="20%" class="windowbg">
<img src="',$boardurl,'/','Games',$row['gameDirectory']."/".$row['thumbnail'],'"></a> ', $row['game_link'],'<br/>
</td>
<td align="center" width="25%" nowrap class="windowbg2">
', $row['member_link'],'
</td>
<td align="center" width="15%" nowrap="nocrap" class="windowbg">
', $row['score'],'
</td>
<td align="center" width="20%" class="windowbg2">
', $row['duration'],'
</td>
</tr>
';
$i++;
}
echo '
</table>';
you might need this mod aswell
http://sleepy-arcade.ath.cx/dev/portal.php?action=tpmod;dl=item48