Welcome, Guest. Please login or register.

ShoutBox!

Scrubmeister

2024-04-19, 10:32:40
Good to see the site back faster than ever. :)
 

Skhilled

2024-04-18, 21:09:09
I've upgraded the server...more resources. ;)
 

Ken

2024-04-18, 20:57:10
Now that you mention it...  :D
 

Skhilled

2024-04-18, 20:47:19
...and, you should notice that the site is much faster.  :o
 

Ken

2024-04-18, 20:31:37
Hey Steve.
 

Skhilled

2024-04-18, 17:56:10
Re-read the message below...
 

Skhilled

2024-03-31, 15:22:06
Oh yeah, you need to upgrade the site first...
 

Ken

2024-03-30, 09:54:54
Whoops! I forgot that the SMF install here on OFF is out of date!  :'(
 

Ken

2024-03-30, 09:44:48
 Conga-Rats Steve!  :thumbup:
Me gonna install it here just for the fun of it!  :)
 

Skhilled

2024-03-29, 22:15:23
Released!  :D

Recent Topics

TP Articles


Search in titles
Search in article texts

Author Topic: The Arcade Block!  (Read 3486 times)

0 Members and 1 Guest are viewing this topic.

Offline Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11676
  • Gender: Male
  • View Gallery
The Arcade Block!
« on: June 12, 2010, 01:28:56 PM »
We've seen some renewed activity in the Arcade lately, so I've turned the Arcade Block back on so that we can keep track of how the players are doing.  :2thumbs:

"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11676
  • Gender: Male
  • View Gallery
Re: The Arcade Block!
« Reply #1 on: June 14, 2010, 04:04:08 PM »
@Underdog:
In the Shoutbox you had said that we should use the code in your post on SMFArcade... is the code snippet below the correct one?

Champs/Stats PHP Portal Block:
Code: [Select]
/* High score/stats block for SMF 2.0 Rcx and SMF Arcade v2.5
   Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
   and upload cup pics... 1.gif, 2.gif, 3.gif, 4.gif, 5.gif, 6.gif, 7.gif, 8.gif, 9.gif, 10.gif
   to your /Themes/default/images/arc_icons/

   -- SETUP EDITS ---   */

$no = 8; //number of most played games to show
$no_games=8;
$icons_per_row = 4;

// --LANGUAGE EDITS --
$txtplay = "The Top Players";
$txtwin = "Number Of Wins :";
$txtlate = "Latest High Score by ";
$txtwit = "with ";
$txton = "on ";

global $scripturl,$sourcedir,$boardurl,$smcFunc,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

$gamesUrl = $boardurl.'/Games/';
//Get newest champ or die
$sql = "SELECT  game.id_game, game.game_name, game.thumbnail, game.game_directory,
             IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name,'') AS real_name, score.score
        FROM {db_prefix}arcade_scores AS score
           LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = score.id_member)
              JOIN {db_prefix}arcade_games AS game ON (game.id_game = score.id_game)
        ORDER BY `champion_from` DESC
        LIMIT 0,1";
if(!($request = $smcFunc['db_query']('', $sql)))
{
   die("Could not get the newest champ");
}
$row = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);

if(isset($row['game_directory']))
{
   $row['game_directory']=$row['game_directory']."/";
}

//newest champ details
$playerid = $row['id_member'];
$player = $row['real_name'];
$game_id = $row['id_game'];
$game_name = $row['game_name'];
$score = $row['score'];
$game_pic = $boardurl."/Games/".$row['game_directory'].$row['thumbnail'];
if ($score == 1e 06)
{ $score = 1000000; }
$bp=ArcadeStats_BestPlayers($no);
$trophy[1] = '<img src="'.$boardurl. '/Themes/default/images/arc_icons/1.gif" border= "0" alt="Gold" />';
$trophy[2]= '<img src="'.$boardurl.'/Themes/default/images/arc_icons/2.gif" border= "0" alt="Silver" />';
$trophy[3] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/3.gif" border= "0" alt="Bronze" />';
$trophy[4] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/4.gif" border= "0" alt="Fourth Place" />';
$trophy[5] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/5.gif" border= "0" alt="Fifth Place" />';
$trophy[6] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/6.gif" border= "0" alt="Sixth Place" />';
$trophy[7] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/7.gif" border= "0" alt="Seventh Place" />';
$trophy[8] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/8.gif" border= "0" alt="Eighth Place" />';
$trophy[9] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/9.gif" border= "0" alt="Ninth Place" />';
$trophy[10] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/10.gif" border= "0" alt="Tenth Place" />';
$score_poss=0; //players position

?>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive ([url=http://www.dynamicdrive.com]www.dynamicdrive.com[/url])
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scrollx=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeedx=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseitx=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=''

function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1) 8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx "px"
else
cross_marqueex.style.top=parseInt(marqueeheightx) 8 "px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marqueex.style.height=marqueeheightx "px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarqueex()",30)', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>
<?php
echo '<table summary="arcspblock1" width="100%"><tr><td align="center"><a href="',$scripturl,'?action=arcade"><img src="',$boardurl,'/Themes/default/images/arc_icons/arcade_block.gif" border= "0" alt="Arcade" /></a>
               <br />
            </td>
         </tr>
      </table>'
;

/* Start 1 of 4 random stats display above top 10 marquee  */
$random_games_choice rand(1,4);
$games_choice 'games'.$random_games_choice;
$curr_position 0;
$games_choice($no_games,$curr_position,$icons_per_row$gamesUrl,$no);
/* END random stats display */ 
echo '

      <div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
         <div id="vmarqueex" style="position: absolute; width: 98%;">
            <div align="center">
               <a href="'
,$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="' $game_pic '" border="0" alt="',$game_name,'" width="60" height="60"/></a>
               <br />'
,$txtlate,'<br />
               <a href="'
,$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
               <br/>'
,$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
               <br />------------------<br />'
,$txtplay,'<br /><br />';
               foreach (
$bp as $out)
               {
                  
$score_poss  ;
                 if (
$score_poss 10)
                    {               
                       
$trophy[$score_poss] ='['.$score_poss.']';
                    }
                  echo 
''.$trophy[$score_poss].'<br />'.$out['link'].'<br />'.$txtwin.' '.$out['champions'].'
                       <br /><br />'
;
               };
   echo 
'</div>
         </div>
      </div>'
;

/* START - Display Functions */
Function games3($no,$curr_position,$icons_per_row$gamesUrl,$no)
{
   global 
$smcFunc$scripturl;
   
//show the latest games
   
echo '<div align="center">Latest Games<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;
   
      
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory
      FROM {db_prefix}arcade_games
      ORDER BY id_game DESC, game_name DESC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {

      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
   
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}

Function 
games1($no,$curr_position,$icons_per_row$gamesUrl,$no)
{
   
//show most played games (one score version only)
    
global $smcFunc$scripturl;

   echo 
'<div align="center">Most Played<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;

    
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory, num_plays
      FROM {db_prefix}arcade_games
      ORDER BY num_plays DESC , game_name ASC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {
      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
   
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}


Function 
games4($no,$curr_position,$icons_per_row$gamesUrl,$no)
{
   
//show least played games (one score version only)
   
global $smcFunc$scripturl;
   echo 
'<div align="center">Least Played<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;

    
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory, num_plays
      FROM {db_prefix}arcade_games
      ORDER BY num_plays ASC , game_name ASC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {
      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
     
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}


Function 
games2($no,$curr_position,$icons_per_row$gamesUrl,$no)
{
   
//show best rated games
    
global $smcFunc$scripturl;
   echo 
'<div align="center">Top Rated<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;

    
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory, game_rating
      FROM {db_prefix}arcade_games
      ORDER BY game_rating DESC , game_name ASC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {
      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
   
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}
/* END - Display Functions  */      
/* END - High Score/Stats Block For SMF 2.0 Rcx */
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Underdog

Re: The Arcade Block!
« Reply #2 on: June 14, 2010, 11:28:24 PM »
Actually no, this is the right code:

Code: [Select]
/* High score/stats block for SMF 2.0 Rcx and SMF Arcade v2.5
   Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
   and upload cup pics... 1.gif, 2.gif, 3.gif, 4.gif, 5.gif, 6.gif, 7.gif, 8.gif, 9.gif, 10.gif
   to your /Themes/default/images/arc_icons/

   -- SETUP EDITS ---   */

$no = 10; /* number of top players to show  */
$no_games = 8;
$icons_per_row = 4;

// --LANGUAGE EDITS --
$txtplay = "The Top Players";
$txtwin = "Number Of Wins :";
$txtlate = "Latest High Score by ";
$txtwit = "with ";
$txton = "on ";

global $scripturl,$sourcedir,$boardurl,$smcFunc,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

$gamesUrl = $boardurl.'/Games/';
//Get newest champ or die
$sql = "SELECT  game.id_game, game.game_name, game.thumbnail, game.game_directory,
             IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name,'') AS real_name, score.score
        FROM {db_prefix}arcade_scores AS score
           LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = score.id_member)
              JOIN {db_prefix}arcade_games AS game ON (game.id_game = score.id_game)
        ORDER BY `champion_from` DESC
        LIMIT 0,1";
if(!($request = $smcFunc['db_query']('', $sql)))
{
   die("Could not get the newest champ");
}
$row = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);

if(isset($row['game_directory']))
{
   $row['game_directory']=$row['game_directory']."/";
}

//newest champ details
$playerid = $row['id_member'];
$player = $row['real_name'];
$game_id = $row['id_game'];
$game_name = $row['game_name'];
$score = $row['score'];
$game_pic = $boardurl."/Games/".$row['game_directory'].$row['thumbnail'];
$bp=ArcadeStats_BestPlayers($no);
$trophy[1] = '<img src="'.$boardurl. '/Themes/default/images/arc_icons/1.gif" border= "0" alt="Gold" />';
$trophy[2]= '<img src="'.$boardurl.'/Themes/default/images/arc_icons/2.gif" border= "0" alt="Silver" />';
$trophy[3] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/3.gif" border= "0" alt="Bronze" />';
$trophy[4] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/4.gif" border= "0" alt="Fourth Place" />';
$trophy[5] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/5.gif" border= "0" alt="Fifth Place" />';
$trophy[6] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/6.gif" border= "0" alt="Sixth Place" />';
$trophy[7] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/7.gif" border= "0" alt="Seventh Place" />';
$trophy[8] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/8.gif" border= "0" alt="Eighth Place" />';
$trophy[9] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/9.gif" border= "0" alt="Ninth Place" />';
$trophy[10] = '<img src="'.$boardurl.'/Themes/default/images/arc_icons/10.gif" border= "0" alt="Tenth Place" />';
$score_poss=0; //players position

?>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive ([url=http://www.dynamicdrive.com]www.dynamicdrive.com[/url])
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scrollx=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeedx=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseitx=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=''

function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1) 8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx "px"
else
cross_marqueex.style.top=parseInt(marqueeheightx) 8 "px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marqueex.style.height=marqueeheightx "px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarqueex()",30)', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>
<?php
echo '<table summary="arcspblock1" width="100%"><tr><td align="center"><a href="',$scripturl,'?action=arcade"><img src="',$boardurl,'/Themes/default/images/arc_icons/arcade_block.gif" border= "0" alt="Arcade" /></a>
               <br />
            </td>
         </tr>
      </table>'
;

/* Start 1 of 4 random stats display above top 10 marquee  */
$random_games_choice rand(1,4);
$games_choice 'games'.$random_games_choice;
$curr_position 0;
$games_choice($no_games,$curr_position,$icons_per_row$gamesUrl,$no);
/* END random stats display */ 
echo '

      <div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
         <div id="vmarqueex" style="position: absolute; width: 98%;">
            <div align="center">
               <a href="'
,$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="' $game_pic '" border="0" alt="',$game_name,'" width="60" height="60"/></a>
               <br />'
,$txtlate,'<br />
               <a href="'
,$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
               <br/>'
,$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
               <br />------------------<br />'
,$txtplay,'<br /><br />';
               foreach (
$bp as $out)
               {
                  
$score_poss  ;
                 if (
$score_poss 10)
                    {               
                       
$trophy[$score_poss] ='['.$score_poss.']';
                    }
                  echo 
''.$trophy[$score_poss].'<br />'.$out['link'].'<br />'.$txtwin.' '.$out['champions'].'
                       <br /><br />'
;
               };
   echo 
'</div>
         </div>
      </div>'
;

/* START - Display Functions */
Function games3($no_games,$curr_position,$icons_per_row$gamesUrl,$no)
{
   global 
$smcFunc$scripturl;
   
//show the latest games
   
echo '<div align="center">Latest Games<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;
   
      
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory
      FROM {db_prefix}arcade_games
      ORDER BY id_game DESC, game_name DESC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no_games,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {

      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
   
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}

Function 
games1($no_games,$curr_position,$icons_per_row$gamesUrl,$no)
{
   
//show most played games (one score version only)
    
global $smcFunc$scripturl;

   echo 
'<div align="center">Most Played<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;

    
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory, num_plays
      FROM {db_prefix}arcade_games
      ORDER BY num_plays DESC , game_name ASC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no_games,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {
      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
   
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}


Function 
games4($no_games,$curr_position,$icons_per_row$gamesUrl,$no)
{
   
//show least played games (one score version only)
   
global $smcFunc$scripturl;
   echo 
'<div align="center">Least Played<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;

    
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory, num_plays
      FROM {db_prefix}arcade_games
      ORDER BY num_plays ASC , game_name ASC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no_games,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {
      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
     
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}


Function 
games2($no_games,$curr_position,$icons_per_row$gamesUrl,$no)
{
   
//show best rated games
    
global $smcFunc$scripturl;
   echo 
'<div align="center">Top Rated<br />
   <table cellpadding="2" cellspacing="5">
   <tr>'
;

    
$result $smcFunc['db_query']('''
      SELECT id_game, game_name, thumbnail, game_directory, game_rating
      FROM {db_prefix}arcade_games
      ORDER BY game_rating DESC , game_name ASC
      LIMIT 0,{int:no}'
,
         array(
         
'no' => $no_games,
         )
      );
      
      while (
$game $smcFunc['db_fetch_assoc']($result))
      {
      
$game_thumb = !$game['game_directory'] ?   $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
      if(
$curr_position == $icons_per_row)
      {
         echo 
'</tr><tr>';
         
$curr_position=0;
      }
      echo
'
      <td>
      <a href="'
.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'">
      <img src="'
.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="30" height="30" title="Play '.$game['game_name'].'" /></a>
      </td>'
;
      
$curr_position  ;
   }
   
$smcFunc['db_free_result']($result);

   echo 
'
   </tr>
   </table></div>'
;
}
/* END - Display Functions  */      
/* END - High Score/Stats Block For SMF 2.0 Rcx */
« Last Edit: June 15, 2010, 05:54:45 PM by Underdog »

Offline Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11676
  • Gender: Male
  • View Gallery
Re: The Arcade Block!
« Reply #3 on: June 15, 2010, 05:56:11 AM »
That code throws an error in the block:
Code: [Select]
Parse error: syntax error, unexpected T_STRING in /home/kenkayjm/public_html/FamilyForum/Sources/Load.php(2119) : eval()'d code(48) : eval()'d code on line 50
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Skhilled

  • Administrator
  • *
  • Posts: 9006
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • View Gallery
    • Buildz Hosting
Re: The Arcade Block!
« Reply #4 on: June 15, 2010, 08:05:48 AM »
I'm probably wrong about this being that I'm not a coder but... php block do not use the php opening and closing tags <?php and ?>, right? They are in there around the javascript section.

Offline Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11676
  • Gender: Male
  • View Gallery
Re: The Arcade Block!
« Reply #5 on: June 15, 2010, 08:50:04 AM »
After removing those it was still throwing an error, the block is back to this code for now:
http://www.smfarcade.info/forum/index.php?topic=7020.msg47792#msg47792
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Underdog

Re: The Arcade Block!
« Reply #6 on: June 15, 2010, 05:47:29 PM »
I'm probably wrong about this being that I'm not a coder but... php block do not use the php opening and closing tags <?php and ?>, right? They are in there around the javascript section.

Maybe for some portals?!

For Simple Portal, Portmx or Tiny Portal ... php tags are not needed...

The block is throwing an error because on some sites I am not able to put plus symbols into code blocks..

let me test outside the code block...   ++++++ + + +

Well... it works in a post but won't work for me in code blocks here.

I am posting a text file... Just open it with -Notepad- or -Edit Pad Lite- then copy and paste the code in the block.

This is the line of code missing the plaus symbol:
if ($score == 1e+06)

but in a code block the plus won't show up for me..
Code: [Select]
if ($score == 1e+06)


« Last Edit: June 15, 2010, 06:00:57 PM by Underdog »

Offline Underdog

Re: The Arcade Block!
« Reply #7 on: June 15, 2010, 05:48:38 PM »
Now it works?

Maybe it has something to do with how some themes change the post color for alternate posts.. I dunno


It wasn't working right on my site either... I just deleted that bit of code from both blocks.. It wasn't really needed anyhow.

The block is ok on SMF Arcade though.
 
« Last Edit: June 15, 2010, 05:54:19 PM by Underdog »

Offline Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11676
  • Gender: Male
  • View Gallery
Re: The Arcade Block!
« Reply #8 on: June 15, 2010, 06:04:13 PM »
The code from your post over on SMFArcade works, but the one posted here is throwing the error... might have missed a bit in the c/p process?


In any case, works good now.  :bigthumb:
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Skhilled

  • Administrator
  • *
  • Posts: 9006
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • View Gallery
    • Buildz Hosting
Re: The Arcade Block!
« Reply #9 on: June 16, 2010, 08:25:25 AM »
Yeah, the php tags aren't needed for TP. I wasn't sure about the other portals. I do intend to do some testing on those.