See above
should be easy enough ;) maybe a random game too, along with a thumb for the game! I'll have a look unless some has done?
ok, here is for a random game, make a php block and add:
require('./Settings.php');
$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);
$game = random_game();
echo "<center><a href=\"index.php?action=arcade;do=play;game={$game['id']}\"><img src=\"{$game['thumbnail']}\" alt=\"{$game['name']}\" /></a><br />
<a href=\"index.php?action=arcade;do=play;game={$game['id']}\">{$game['name']}</a></center>";
// Functions begin
// All returns array
// random_game( [category id] )
function random_game($cat_id = ""){
global $link,$db_prefix,$boarddir,$boardurl;
if($cat_id == ""){
$query = "SELECT * FROM {$db_prefix}games ORDER BY rand() LIMIT 0,1";
}else{
$query = "SELECT * FROM {$db_prefix}games WHERE category='{$cat_id}' ORDER BY rand() LIMIT 0,1 ";
}
$game = mysql_fetch_array(mysql_query($query));
$ext = array('gif','GIF','png','PNG','jpg','JPG',); // Extensions to look for
$game['thumbnail'] = ""; // No thumbnail for default
foreach($ext as $ex){
if(file_exists($boarddir. "/Games/".$game['game'].".".$ex)){
$game['thumbnail'] = $boardurl."/Games/".$game['game'].".".$ex;
}
}
return $game;
}
-snork
edited to fixed the <center></center>
sorry :idiot2:
Wow that was fast. Thanks a lot. Ask a simple question and get a great response. I'll give it a try.
Quote from: houston on November 08, 2005, 06:00:39 AM
Wow that was fast. Thanks a lot. Ask a simple question and get a great response. I'll give it a try.
it's just for random games, not a champion list...i'll do that next!
-snork
Thanks snork! Works like a charm.
Good job ! :-)
ok, this will pull the highscores from smfarcade into a php block. So you will need a need php block ;D and in the function highscore($count = 5, $game = "", $cutoff = 0)
// highscore( int [count=10], str [game internal name], int [cutoff older than] )
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\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$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}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.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;
}
thank to Niko (mod authur) for the help
Thanks Guys. Really appreciate the hard work and time that you put into this stuff.
Thanks, snork13. I think this is MUCH better than the extra long champions list under everybody's avatar! Saves page space as well. ;)
How do I put that code in a iframe?? using a static page :idiot2:
If the static page can use PHP just add echo '<iframe>';
echo '</iframe>'; where you need to.
tried this but get a blank page
Quote<?php
echo '<iframe>';
require('./Settings.php');
$top = highscore();
//echo "".print_r($top,true)."
";
foreach($top as $temp){
echo"<table align=\"center\" width=\"50%\"><tr><td align=\"center\" class=\"smalltext\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$temp['score']}</td></tr><tr><td width=\"50%\">
</td></tr></table>";
}
function highscore($count = 30, $game = "", $cutoff = 0)
{
global $link,$db_prefix,$boarddir,$boardurl;
if($game == "")
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.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;
}
echo '</iframe>';
?>
You may want to move the iframe tags to surround your HMTL code, not the whole PHP code. And if you're running this in TP in an article or block you don't need the php tags. I don't have the arcade or I would test this to make sure it works. Try this:
require('./Settings.php');
$top = highscore();
//echo "
".print_r($top,true)."
";
foreach($top as $temp){
echo '<iframe>';
echo"<table align=\"center\" width=\"50%\"><tr><td align=\"center\" class=\"smalltext\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$temp['score']}</td></tr><tr><td width=\"50%\"></td></tr></table>";
echo '</iframe>';
}
function highscore($count = 30, $game = "", $cutoff = 0)
{
global $link,$db_prefix,$boarddir,$boardurl;
if($game == "")
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.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;
}
Quote from: snork13 on November 19, 2005, 07:42:42 PM
ok, this will pull the highscores from smfarcade into a php block. So you will need a need php block ;D and in the function highscore($count = 5, $game = "", $cutoff = 0)
// highscore( int [count=10], str [game internal name], int [cutoff older than] )
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\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$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}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.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;
}
thank to Niko (mod authur) for the help
I tried that and it works but whenever I'm in side the arcade it gives this error:
Fatal error: Cannot redeclare highscore() (previously declared in /public_html/other/Sources/Arcade2.php:281) in /public_html/other/Sources/Load.php(1598) : eval()'d code(32) : eval()'d code on line 11
Quote from: winrules on December 09, 2005, 03:06:55 PM
Quote from: snork13 on November 19, 2005, 07:42:42 PM
ok, this will pull the highscores from smfarcade into a php block. So you will need a need php block ;D and in the function highscore($count = 5, $game = "", $cutoff = 0)
// highscore( int [count=10], str [game internal name], int [cutoff older than] )
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\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$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}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.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;
}
thank to Niko (mod authur) for the help
I tried that and it works but whenever I'm in side the arcade it gives this error:
Fatal error: Cannot redeclare highscore() (previously declared in /public_html/other/Sources/Arcade2.php:281) in /public_html/other/Sources/Load.php(1598) : eval()'d code(32) : eval()'d code on line 11
I have the same error in the arcade. I had just upraded to the latest version and noticed it there. I have since removed the block until I had time to solve the problem.
any answer found on this subject yet?
Fatal error: Cannot redeclare highscore() (previously declared in /home/resellers/xxxx/xxxxx/corenation.com/www/smf/Sources/Arcade2.php:281) in /home/resellers/xxxxx/xxxx/corenation.com/www/smf/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 11
Quote from: core on January 24, 2006, 04:47:04 PM
any answer found on this subject yet?
Fatal error: Cannot redeclare highscore() (previously declared in /home/resellers/xxxx/xxxxx/corenation.com/www/smf/Sources/Arcade2.php:281) in /home/resellers/xxxxx/xxxx/corenation.com/www/smf/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 11
Not yet. Unless someone has found a solution and has not posted it yet.
They upgraded thier site today and installed TP on it. So it's just a matter of time before they write a script that allows that.
nice ;D TP rocks
any further progress on fixing this bug?
I am running the latest version of TP on top of RC2 and this worked easily.
One question I have - is there a way to limit it to reporting just one high score per game?
[attachment deleted by admin]
Try this code
http://www.rranderson.com/arcade/index.php?topic=62.0
nice code m8!
thanks
Quote from: Ray on February 23, 2006, 06:07:41 PM
Try this code
http://www.rranderson.com/arcade/index.php?topic=62.0
Ray, be glad you're there and I am here - because if I could lay my hands on you, I'd kiss you. :D
Thank you!
RUN LIKE THE WIND RAY!!!
Quote from: TwinsX2Dad on February 24, 2006, 02:09:46 AM
Quote from: Ray on February 23, 2006, 06:07:41 PM
Try this code
http://www.rranderson.com/arcade/index.php?topic=62.0
Ray, be glad you're there and I am here - because if I could lay my hands on you, I'd kiss you. :D
Thank you!
am I safe? lol
Thanks for this info Ray. Unfortunatly I am getting a parse error in my load.php file.
Parse error: parse error, unexpected '[' in /home/eaglebay/public_html/forum/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 1
I have looked at line 1607 and can not see a [ in that line. This is what I am seeing.
// Are we going to use eval?
if (empty($modSettings['disableTemplateEval']))
{
$file_found = file_exists($filename) && eval('?' . '>' . rtrim(file_get_contents($filename))) !== false;
$settings['current_include_filename'] = $filename;
}
else
{
$file_found = file_exists($filename);
if ($once && $file_found)
require_once($filename);
elseif ($file_found)
require($filename);
}
if ($file_found !== true)
{
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']))
@ob_start('ob_gzhandler');
else
ob_start();
if (isset($_GET['debug']) && !WIRELESS)
header('Content-Type: application/xhtml+xml; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
This is from line line 1604 to line 1626 line 1607 is red.
Does anybody have any thoughts on this error
Thanks
Are you using the same versions of arcade mod, and SMF? as this is written for?
Quote from: borgBOB on February 24, 2006, 05:05:40 AM
Are you using the same versions of arcade mod, and SMF? as this is written for?
SMF 1.1 RC2 and arcade 1.2.4b
The package manager says that it is 1.2.4 but the arcade pages tell me that it is powered by 1.2.4b
Quote from: houston on February 24, 2006, 04:12:34 AM
Thanks for this info Ray. Unfortunatly I am getting a parse error in my load.php file.
Parse error: parse error, unexpected '[' in /home/eaglebay/public_html/forum/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 1
I have looked at line 1607 and can not see a [ in that line. This is what I am seeing.
// Are we going to use eval?
if (empty($modSettings['disableTemplateEval']))
{
$file_found = file_exists($filename) && eval('?' . '>' . rtrim(file_get_contents($filename))) !== false;
$settings['current_include_filename'] = $filename;
}
else
{
$file_found = file_exists($filename);
if ($once && $file_found)
require_once($filename);
elseif ($file_found)
require($filename);
}
if ($file_found !== true)
{
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']))
@ob_start('ob_gzhandler');
else
ob_start();
if (isset($_GET['debug']) && !WIRELESS)
header('Content-Type: application/xhtml+xml; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
This is from line line 1604 to line 1626 line 1607 is red.
Does anybody have any thoughts on this error
Thanks
I havent had any errors with it - umm You are using a php box right??
Quote from: Ray on February 24, 2006, 05:20:03 AM
Quote from: houston on February 24, 2006, 04:12:34 AM
Thanks for this info Ray. Unfortunatly I am getting a parse error in my load.php file.
Parse error: parse error, unexpected '[' in /home/eaglebay/public_html/forum/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 1
I have looked at line 1607 and can not see a [ in that line. This is what I am seeing.
// Are we going to use eval?
if (empty($modSettings['disableTemplateEval']))
{
$file_found = file_exists($filename) && eval('?' . '>' . rtrim(file_get_contents($filename))) !== false;
$settings['current_include_filename'] = $filename;
}
else
{
$file_found = file_exists($filename);
if ($once && $file_found)
require_once($filename);
elseif ($file_found)
require($filename);
}
if ($file_found !== true)
{
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']))
@ob_start('ob_gzhandler');
else
ob_start();
if (isset($_GET['debug']) && !WIRELESS)
header('Content-Type: application/xhtml+xml; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
This is from line line 1604 to line 1626 line 1607 is red.
Does anybody have any thoughts on this error
Thanks
I havent had any errors with it - umm You are using a php box right??
Yes I am
Need link to site, sometimes a good mechanic needs to look under the hood. Admin test account would be cool also, but only PM that info.
Quote from: borgBOB on February 24, 2006, 05:24:58 AM
Need link to site, sometimes a good mechanic needs to look under the hood. Admin test account would be cool also, but only PM that info.
I will set one up for you ASAP
May only need a copy of your load.php file. First attach one here.
Attached load.php file
[attachment deleted by admin]
I can find zero differences between your load.php, and one that works on my sites houston. I think this is one of those cryptic errors, that is misleading us.
The only mod that changes load.php is TP, and those edits are no where near the error you are getting.
Quote from: borgBOB on February 24, 2006, 05:46:22 AM
I can find zero differences between your load.php, and one that works on my sites houston. I think this is one of those cryptic errors, that is misleading us.
The only mod that changes load.php is TP, and those edits are no where near the error you are getting.
Thanks for having a look at it. As much as I would love to have this block running. It is not that important right now. I will keep it deactivated and have another look at it later.
And thanks again for your prompt reply.
houston, do you have a " <?php "
in your php block? If yes, then remove it.
this is the code I am using
/*
|----------------------------------
SMF ARCADE CHAMPS BLOCK
by Eric Lawson
|----------------------------------
Made for
TinyPortal
SMF SMF forum 1.1RC1/RC2
SMF Arcade_1.2.4b (1.2.4 should be ok :) )
And Works with Beta Arcade
*/
//Upload the arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder
// -- SETUP EDITS ---
$db_prefix = 'arcade_'; //edit this to your your database prefix - usually smf_
$no = 10; //number of top players to show
// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language
require('./Settings.php');
$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);
// --START BLOCK CODE --
$content = ""; //set blank for a start
//Get newest champ or die
$sql = "SELECT m.ID_MEMBER,m.realName,g.id, g.game, g.name,g.champion_score "
. "FROM {$db_prefix}members m , {$db_prefix}games g "
. "WHERE g.champion_score > 0 AND m.ID_MEMBER=g.champion_member "
. "ORDER BY g.champion_time DESC LIMIT 0,1";
if(!($result = mysql_query($sql,$link)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['id'];
$game_name = $row['name'];
$score = $row['champion_score'];
//now get the pic for the game
$ext = array('gif','GIF','png','PNG','jpg','JPG',);
$game_pic = ""; // No thumbnail for default
foreach($ext as $ex)
{
if(file_exists($boarddir. "/Games/".$row['game'].".".$ex))
{
$game_pic = $boardurl."/Games/".$row['game'].".".$ex;
}
}
//Get the 10 best players or die
$sql = "SELECT m.ID_MEMBER, m.realName, count(g.id) As cnt"
. " FROM {$db_prefix}games g, {$db_prefix}members m"
. " WHERE m.ID_MEMBER=g.champion_member"
. " GROUP BY realName "
. " ORDER BY cnt DESC LIMIT 0,{$no}";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the best players");
}
$row = mysql_fetch_assoc($result);
$score_poss=0; //players position
//make the block content
$content .= "<table width=\"100%\" ><tr>
</tr>";
$content .= "
<tr>
<td>
<marquee behavior='scroll' align='center' direction='up' height='160' scrollamount='1' scrolldelay='50' onmouseover='this.stop()' onmouseout='this.start()'>
<br />
<div align=\"center\"><a href=\"{$scripturl}?action=arcade;sa=play;game={$game_id}\"><img src=\"{$game_pic}\" border= \"0\" /></a>
<br />{$txtlate}<br />
<a href=\"{$scripturl}?action=profile;u=$playerid\">{$player}</a><br />{$txtwit} {$score} {$txton} {$game_name}
<br />------------------<br />{$txtplay}
<br /> ";
do
{
$score_poss++;
$content .= "
$score_poss -
<a href=\"{$scripturl}?action=profile;u=".$row['ID_MEMBER']."\"> ".$row['realName']."</a>
<br /> $txtwin ".$row['cnt']."
<br /><br />";
} while ($row = mysql_fetch_assoc($result));
mysql_free_result($result);
$content .= "</marquee></div></td></tr></table>" ;
echo $content;
Quote from: Ray on February 24, 2006, 03:16:32 AM
am I safe? lol
Of course you are - I can see your picture! :D
Now to the problem at hand. I was careless on my first copy/paste and picked up a BB code error on Ray's site. The code starts with this:
[code/*
|----------------------------------
SMF ARCADE CHAMPS BLOCK
by Eric Lawson
|----------------------------------
Made for
TinyPortal
SMF SMF forum 1.1RC1/RC2
SMF Arcade_1.2.4b (1.2.4 should be ok :) )
And Works with Beta Arcade
*/
Notice at the very beginning there is a "[code" that needs to be removed. When I returned to edit it, it was hidden up off the edit field, so it caused me about 3 minutes of frustration in not seeing it. It was my own stupidity, so I took me out back and kicked my tail.
It works perfectly now. Well, there are occasional scrolling hiccups, but I can live with those.
Thanks for pointing that out TwinsX2Dad -- I fixed it on my site so others will not have to go through what you did ???-- hey what is wrong with my picture :idiot2:
I love you guys. Thanks for the fix. :laugh:
Quote from: Ray on February 24, 2006, 04:37:52 PM
Thanks for pointing that out TwinsX2Dad -- I fixed it on my site so others will not have to go through what you did
The really funny thing was that I saw that when I first looked at the code - then I copied it anyway.
Quote from: Ray on February 24, 2006, 04:37:52 PM-- hey what is wrong with my picture :idiot2:
Nothing other than you have facial hair, indicating you're not of the opposite gender. You're a fine looking individual - just not someone I'd want to wake up next to. :D
Quote from: houston on February 24, 2006, 08:45:19 PMI love you guys. Thanks for the fix. :laugh:
I was all worried that you'd come back and tell me you'd checked that already. But it just mirrored what I experienced, so I had to bring it up.
Happy to have been of assistance.
I keep getting undefind variable script url errors... Ten of them each time the page with that block is visited.
I added it as a php block and inserted all of the code. The block displays fine. I am using Rays code.
Add this to the top of your block code if it isn't already.
global $scripturl;
O'kay but where should I add that ? LOL!!!
Worked great!! Thanks!! ;D
Question guys - I've lost my arcade_block.gif
I am using the Eric code from Ray's site - RC2 & TP 0.8.6
Everything worked fine, until I configured the TPEpsilon theme for use through the TP block. My arcade_block.gif worked on both themes, but the scroll ceased operation, leaving the window blank.
I went back and checked everything - there was nothing in this block I changed. Still, I figured I'd reinstall it. Went back to Ray's site and got the code again. I entered it and the scrolling returned, but the arcade_block.gif isn't in use anymore.
I have verified that it is in both themes' image folder. It just isn't appearing in the block. It may be better this way, but I spent some time working up a cool gif for that. :D
did you use this one??
http://www.rranderson.com/arcade/index.php?topic=62.0
and you are putting it in a php block?
this is the code I use on my site -- without the gif file -
global $scripturl;
/*
|----------------------------------
SMF ARCADE CHAMPS BLOCK
by Eric Lawson
|----------------------------------
Made for
TinyPortal
SMF SMF forum 1.1RC1/RC2
SMF Arcade_1.2.4b (1.2.4 should be ok :) )
And Works with Beta Arcade
*/
//Upload the arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder
// -- SETUP EDITS ---
$db_prefix = 'arcade_'; //edit this to your your database prefix - usually smf_
$no = 10; //number of top players to show
// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language
require('./Settings.php');
$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);
// --START BLOCK CODE --
$content = ""; //set blank for a start
//Get newest champ or die
$sql = "SELECT m.ID_MEMBER,m.realName,g.id, g.game, g.name,g.champion_score "
. "FROM {$db_prefix}members m , {$db_prefix}games g "
. "WHERE g.champion_score > 0 AND m.ID_MEMBER=g.champion_member "
. "ORDER BY g.champion_time DESC LIMIT 0,1";
if(!($result = mysql_query($sql,$link)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['id'];
$game_name = $row['name'];
$score = $row['champion_score'];
//now get the pic for the game
$ext = array('gif','GIF','png','PNG','jpg','JPG',);
$game_pic = ""; // No thumbnail for default
foreach($ext as $ex)
{
if(file_exists($boarddir. "/Games/".$row['game'].".".$ex))
{
$game_pic = $boardurl."/Games/".$row['game'].".".$ex;
}
}
//Get the 10 best players or die
$sql = "SELECT m.ID_MEMBER, m.realName, count(g.id) As cnt"
. " FROM {$db_prefix}games g, {$db_prefix}members m"
. " WHERE m.ID_MEMBER=g.champion_member"
. " GROUP BY realName "
. " ORDER BY cnt DESC LIMIT 0,{$no}";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the best players");
}
$row = mysql_fetch_assoc($result);
$score_poss=0; //players position
//make the block content
$content .= "<table width=\"100%\" ><tr>
</tr>";
$content .= "
<tr>
<td>
<marquee behavior='scroll' align='center' direction='up' height='160' scrollamount='1' scrolldelay='50' onmouseover='this.stop()' onmouseout='this.start()'>
<br />
<div align=\"center\"><a href=\"{$scripturl}?action=arcade;sa=play;game={$game_id}\"><img src=\"{$game_pic}\" border= \"0\" /></a>
<br />{$txtlate}<br />
<a href=\"{$scripturl}?action=profile;u=$playerid\">{$player}</a><br />{$txtwit} {$score} {$txton} {$game_name}
<br />------------------<br />{$txtplay}
<br /> ";
do
{
$score_poss++;
$content .= "
$score_poss -
<a href=\"{$scripturl}?action=profile;u=".$row['ID_MEMBER']."\"> ".$row['realName']."</a>
<br /> $txtwin ".$row['cnt']."
<br /><br />";
} while ($row = mysql_fetch_assoc($result));
mysql_free_result($result);
$content .= "</marquee></div></td></tr></table>" ;
echo $content; the gif file you will need to put it i the themes folder that you are running this block from - you can get the gif from the link or you can copy it out of a theme folder that was working for you
I must have grabbed the wrong code - the one without the gif image. This time, I've saved both code examples in case of future foul ups by me.
Thanks Ray!
Ray your code doesn't pull up the the arcade gif. It's missing this code:
//make the block content
$content .= "<table width=\"100%\" ><tr>
<td align=\"center\">
<a href=\"{$scripturl}?action=arcade\"><img src=\"{$settings['images_url']}/arcade_block.gif\" border= \"0\" alt=\"Arcade\" /></a>
</td>
</tr>";
their are 2 codes -- one has all the code and the other is cut down
here is the link to the code with the icon at the top
http://www.rranderson.com/arcade/index.php?topic=62.0
I noticed after I posted that you don't use the gif on your site.
;)
Thank Ray ! That's nice coding I'm looking for ;)
First of all i wanna say thank you for this great code, works just fine :)
I just have a question about high score block.
It shows me 2 things: The latest high score and top players.
Now the latest high score works great but i don't understand (and many on my site 2), how the top players is working.
One moment it shows 4 players ,then only 2, then 3. Is that normal? I thought it shows top 10 players.
And one moment some1 has 4 wins , then 2, then only 1 and that if he didn't play at all.
So can some1 explain me the working of this?
Greetings
It ranks the top 10 players by the number of trophies (highscores) they have.
If it is showing less, then it could very well mean that people are playing in the arcade and the high scores are being swapped out between players.
And this is normal?
So when i had 4 wins yesterday and i was in place 2 of top players for example.
And today i login , im not on the list anymore even if they play other games?
If someone else gets the high score then yes.
Anyone getting this red x? Is it because I have a fresh install with no winners yet? I'm on SMF 1.1 RC2, TP 0.8.6 with Arcade 1.2.4b.
Everyone does - that is for your own arcade image. Make one or grab a Pacman image.
Make sure the path to the gif is correct.
Some arcade games have not a gif for thumbnail and so it's will not show on the arcade champion block ;D
That is a missing image. Right click on it and choose properties. In the properties window you'll see where the file is supposed to be located.
That arcade image you need to add yourselfe. It dont apply from the package manager on install.
Back at SMFarcade homepage you have some images to choose from. I made my own though.
In the package there should be an image to for you to put in manually.
Quote from: IchBinâââ,¬Å¾Ã,¢ on March 23, 2006, 02:07:29 PM
That is a missing image. Right click on it and choose properties. In the properties window you'll see where the file is supposed to be located.
It just points to my test site forum - http://www.avalanchestyle-test.com/forum/
Quote from: G6 on March 23, 2006, 02:09:42 PM
That arcade image you need to add yourselfe. It dont apply from the package manager on install.
Back at SMFarcade homepage you have some images to choose from. I made my own though.
In the package there should be an image to for you to put in manually.
I can do that no problem, but what should I name file and where should I save it to since I can't see the properties of the red x other than the URL I have above?
If you are using this code http://www.rranderson.com/arcade/index.php?topic=62.0
Then it tells you at the top where to put the gif
The image name is "arcade_block.gif" And you put it in the image folder for the theme you are using or and default theme images folder
Quote from: JayT on March 23, 2006, 09:29:07 PM
If you are using this code http://www.rranderson.com/arcade/index.php?topic=62.0
Then it tells you at the top where to put the gif
Using the code from the link I get the one image, but there is still one missing. When I click on the red x and brings me to the screen that tells me the status of my challenges. Does anyone have a working code I can see?
That is supposed to be the small gif that represents an individual game. The one for Sonic Blox is attached for reference.
Quote from: RoarinRow on March 23, 2006, 10:20:34 PM
Quote from: JayT on March 23, 2006, 09:29:07 PM
If you are using this code http://www.rranderson.com/arcade/index.php?topic=62.0
Then it tells you at the top where to put the gif
Using the code from the link I get the one image, but there is still one missing. When I click on the red x and brings me to the screen that tells me the status of my challenges. Does anyone have a working code I can see?
It appears you do not have the arcade installed properly. Got www.smfarcade.net for support.
Tried to look at your games but do not have permission -- does you game graphics show up?? looks like you have a wrong setting in your arcade admin settings -- like the path to your graphics are wrong?? not sure though cause I cant see them. check it and see if it like this
http://www.avalanchestyle-test.com/forum/arcade/Games
is there a champ block for use with Arcade 1.2.3? the one i tired of for Arcade_1.2.4b
i know your thinking upgrade the arcade... tried but got to many errors so i went back to 1.2.3.
most the add on work with the newer visions and really have not been tested with the old stuff. What kind of errors did you get and before you went back to the older version did you check smfarcade ?? - Did you uninstall the old version and reinstall the new?? You will not lose any data-hopefully
Quote from: Ray on March 24, 2006, 04:18:44 AM
Tried to look at your games but do not have permission -- does you game graphics show up?? looks like you have a wrong setting in your arcade admin settings -- like the path to your graphics are wrong?? not sure though cause I cant see them. check it and see if it like this
http://www.avalanchestyle-test.com/forum/arcade/Games
My path is like this - http://www.avalanchestyle-test.com/forum/Games. Should it be like how you have it above?
Edit - I tried adding the arcade folder and changing the arcade settings, but that didn't work.
What code should I edit to remove the .gif files entirely and just have the name of the game and the member's name?
QuoteMy path is like this - http://www.avalanchestyle-test.com/forum/Games. Should it be like how you have it above?
No you are correct-- could you give me admin rights so I can look at the setup??I still think it is a path problem
QuoteWhat code should I edit to remove the .gif files entirely and just have the name of the game and the member's name?
http://www.rranderson.com/arcade/index.php?topic=87.0
One more thing did you run the database file that came with the mode??the arcade_install.php file I think
Quote from: Ray on March 24, 2006, 05:07:42 PM
QuoteMy path is like this - http://www.avalanchestyle-test.com/forum/Games. Should it be like how you have it above?
No you are correct-- could you give me admin rights so I can look at the setup??I still think it is a path problem
QuoteWhat code should I edit to remove the .gif files entirely and just have the name of the game and the member's name?
http://www.rranderson.com/arcade/index.php?topic=87.0
One more thing did you run the database file that came with the mode??the arcade_install.php file I think
Thanks Ray. Since you registered already, I just updated your profile to Administrator so you can check it out.
Yes I ran the arcade_install.php file after the installation, then again just to be sure. I believe the message I saw was 'database updated' after running that command.
I looked around and all seemed ok -- have you done this hack -- I think you need to use it
http://www.rranderson.com/arcade/index.php?topic=46.0
try it and see if that will fix it
ummm got this error
Database Error
Table 'avs1.avs1_games_sessions' doesn't exist
File: /forum/Sources/Arcade.php
Line: 448
check and see if that is really their or not?? the table
also you might want to check you Arcade.english.php -- getting errors from that
Quote from: Ray on March 25, 2006, 04:52:02 AM
ummm got this error
Database Error
Table 'avs1.avs1_games_sessions' doesn't exist
File: /forum/Sources/Arcade.php
Line: 448
check and see if that is really their or not?? the table
also you might want to check you Arcade.english.php -- getting errors from that
Thanks Ray. I check and I do not have the 'avs1.avs1_games_sessions' table. When I tried to create it in mysql, it wouldn't let me. I got an error. My production site that also has the games installed does have the 'smf.smf_games_sessions' table. How did you get that error?
I checked my arcade.english.php file as well as all other arcade files and there is no reference to 'caterogy'.
I uninstalled and re-installed Arcade and got a bunch of other errors. :tickedoff:
Quote from: Ray on March 25, 2006, 04:38:55 AM
I looked around and all seemed ok -- have you done this hack -- I think you need to use it
http://www.rranderson.com/arcade/index.php?topic=46.0
try it and see if that will fix it
That didn't work, but thanks for the hack. :)
Looks like you the word category spelled wrong -- their is a fix for this on smfarcade.net -- I will go look to see if I can find it
Here -- go threw here and do the data base fix -- I am sure now it is the data base
http://www.smfarcade.net/index.php/topic,290.15.html
Think I found your problem-- in the arcade_install.php see if these lines are in their??
$failsc = 0;
$db_version = '1.0.5';
/* Tables to check */
$tables[0][0] = $db_prefix.'games';
$tables[1][0] = $db_prefix.'games_challenge';
$tables[2][0] = $db_prefix.'games_high';
$tables[3][0] = $db_prefix.'games_caterogy';
$tables[3]['create'] = false;
$tables[3]['rename'] = $db_prefix.'games_category';
$tables[4][0] = $db_prefix.'games_category';
//$tables[5][0] = $db_prefix.'games_sessions';
//$tables[6][0] = $db_prefix.'games_champ';
$tables[7][0] = $db_prefix.'games_favorite';
$tables[8][0] = $db_prefix.'games_settings';
$tables[9][0] = $db_prefix.'games_tournament';
$tables[10][0] = $db_prefix.'games_tournament_players';
$tables[11][0] = $db_prefix.'games_tournament_results';
$tables[12][0] = $db_prefix.'games_tournament_scores';
$tables[13][0] = $db_prefix.'games_rate';
$tables[14][0] = $db_prefix.'games_menus';
this renames the caterogy table to category
Quote from: Ray on March 25, 2006, 08:14:50 AM
Think I found your problem-- in the arcade_install.php see if these lines are in their??
$failsc = 0;
$db_version = '1.0.5';
/* Tables to check */
$tables[0][0] = $db_prefix.'games';
$tables[1][0] = $db_prefix.'games_challenge';
$tables[2][0] = $db_prefix.'games_high';
$tables[3][0] = $db_prefix.'games_caterogy';
$tables[3]['create'] = false;
$tables[3]['rename'] = $db_prefix.'games_category';
$tables[4][0] = $db_prefix.'games_category';
//$tables[5][0] = $db_prefix.'games_sessions';
//$tables[6][0] = $db_prefix.'games_champ';
$tables[7][0] = $db_prefix.'games_favorite';
$tables[8][0] = $db_prefix.'games_settings';
$tables[9][0] = $db_prefix.'games_tournament';
$tables[10][0] = $db_prefix.'games_tournament_players';
$tables[11][0] = $db_prefix.'games_tournament_results';
$tables[12][0] = $db_prefix.'games_tournament_scores';
$tables[13][0] = $db_prefix.'games_rate';
$tables[14][0] = $db_prefix.'games_menus';
this renames the caterogy table to category
Of course it was the one file I didn't check. :uglystupid2:
I found about 3 instances of 'caterogy' and changed it to 'category', then re-ran the script.
Got this error:
Query failed: RENAME TABLE avs1_games_category TO avs1_games_categoryTable 'avs1_games_category' already exists
Error while updating
Edit - when looking at the code more closely through out the file it looks like it's actually fixing the instances of 'caterogy' to 'category'.
nice work.. :)
I still have the same problem. I even installed on a fresh forum and still same thing. >:(
Quote from: RoarinRow on March 31, 2006, 05:30:27 AM
I still have the same problem. I even installed on a fresh forum and still same thing. >:(
Na your arcade is working now -- well in the default theme, take all the arcade files out of the blue101 folder and you should be ok - enjoy
Quote from: Ray on March 31, 2006, 06:32:20 AM
Quote from: RoarinRow on March 31, 2006, 05:30:27 AM
I still have the same problem. I even installed on a fresh forum and still same thing. >:(
Na your arcade is working now -- well in the default theme, take all the arcade files out of the blue101 folder and you should be ok - enjoy
Can't thank you enough Ray! That fixed at least 3 pages of errors per person. You da man!
Works like a charm for me ^^
brilliants!
when i install this script
require('./Settings.php');
$top = highscore();
//echo "
".print_r($top,true)."
";
foreach($top as $temp){
echo"<table align=\"center\" width=\"100%\"><tr><td align=\"center\" class=\"smalltext\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$temp['score']}</td></tr><tr><td width=\"100%\">
</td></tr></table>";
}
function highscore($count = 5, $game = "", $cutoff = 0)
{
global $link,$db_prefix,$boarddir,$boardurl;
if($game == "")
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.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 cannot acces my forum also in admin panel...
where did you install that script, in a block? or in your index.template.php file or something?
i put this script in tpblock php
You have to manually fo in to your database through phpmyadmin or what ever program you have to maintain your DB and remove the block manuallyfrom the tables, that will bring your forum back again.
And this code should work fine in a php block with out errors, i use the exact same block on my forum
Quote from: alhaudhie on February 07, 2007, 04:53:42 AM
i cannot acces my forum also in admin panel...
This is the reason you should leave blocks set to off in your admin panel. So that if you have an error in a block it doesn't nerf your whole forum.
I tried to put code as PHP but I am getting error:
"Table 'lamhai_smf.smf_games' doesn't exist"
Please start your own topic on SMFARCADE.INFO as the arcade is their mod to give you the support on.
There are 2 arcades...the database tables are different. Code for arcade1 wont work with Arcade2.
I use this code but it wont display. using smf 1.1.3 arcade version 2.0.9
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\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$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}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.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;
}
error: Table 'smf.smf_games' doesn't exist
thanks in advance
Just what eeek say, you cant use the code for the older arcade for the new arcade, they dont use the same files or DB
Is there a block that is working on arcade 2.0.12
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
That was what I was looking for, Broc. Thanks!