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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 291
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 143
  • Total: 143

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.

Ray

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:

houston


TwinsX2Dad

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.

Gargoyle

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.

IchBin

Add this to the top of your block code if it isn't already.

global $scripturl;



TwinsX2Dad

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

Ray

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


TwinsX2Dad

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!

This website is proudly hosted on Crocweb Cloud Website Hosting.