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,973
  • Latest: NonStop
Stats
  • Total Posts: 196,234
  • Total Topics: 21,353
  • Online today: 739
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 267
  • Total: 267

Arcade champion block score

Started by Polymath, November 17, 2006, 06:01:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Polymath

Hi guys,

Sorry if its already here but I can't find it using the keywords search.

But anyway My champions block(the scrolling one on home page) has the scores showing wrong. Its the only block it does it in and it looks untidy and unprofessional. Its another thing in a list that I want to try and fix.  I fixed this in the arcade pages months ago. So its now only this block that needs score corrected.

what does it show?  6.00078E+06 for the million scores

heres the block 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


*/


//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>
<td align=\"center\">







</td>
</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 /><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;


and if you could point me to the thread for the fix or what I need to do would me many thanks.

Thankyou.

rebelrose

This should be in the block code snippets as it is not a TP function but a code added to a block.

RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Polymath

Yeah sorry. I thought it was a TP block. I've been there and repaired the blocks in the arcade but not in my SMF/TP.

I'll put it there.

Polymath


rebelrose

This topic was moved to the block snippet area Polymath. I hope you get it worked out on your site.

RoarinRow

Here's the fix from eeek - smfarcade

Quote from: eeek on November 17, 2006, 07:44:06 PM
untested but should do the trick...

In the posted code above

Replace
$score = $row['champion_score'];

With
$score = round($row['champion_score'],2);

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Polymath

Beat me to it there RoarinRow. Just came in to post it. Lol.

Changed it at my site and as yet not tested will have to wait for another million score.

Cheers.

RoarinRow

Quote from: Polymath on November 17, 2006, 08:54:58 PM
Beat me to it there RoarinRow. Just came in to post it. Lol.

Changed it at my site and as yet not tested will have to wait for another million score.

Cheers.

hahaha, sorry.  I applied the fix myself.    :o

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Polymath

Well good. I always thought it was an error I had.. not something everybody had.

lol

This website is proudly hosted on Crocweb Cloud Website Hosting.