| View previous topic :: View next topic |
| Author |
Message |
TONY[-TOC-]
Joined: May 20, 2009 Posts: 242
Reputation: 31.3   votes: 1

Status: Offline
|
Posted: Thu Apr 08, 2010 4:45 pm Post subject: Re: Bad Company 2 Stats block |
|
|
2 questions for ya SgtLegend
1. My module always has "There is 1 member(s) in the queue waiting to have their stats processed" when I know there is no one in queue.
2. Much harder question and I hate to be a pain but I am trying to get a progress bar to show up under the rank on the module index page ( eventually I also want it on the player profile page as well ) like I have on my block ( www.toctheothercrew.com ). I am not sure what I am doing wrong here.
First I put in the ranks array just after the //prep the members area ( did not know where to put it so I just used the same placement I have in my block
| Quote: | $rankpoints=array(
0 => 0,
1 => 6500,
2 => 11000,
3 => 18500,
4 => 28000,
5 => 40000,
6 => 53000,
7 => 68000,
8 => 84000,
9 => 100000,
10 => 120000,
11 => 138000,
12 => 158000,
13 => 179000,
14 => 200000,
15 => 224000,
16 => 247000,
17 => 272000,
18 => 297000,
19 => 323000,
20 => 350000,
21 => 377000,
22 => 405000,
23 => 437000,
24 => 472000,
25 => 537000,
26 => 620000,
27 => 720000,
28 => 832000,
29 => 956000,
30 => 1092000,
31 => 1240000,
32 => 1400000,
33 => 1550000,
34 => 1730000,
35 => 1900000,
36 => 2100000,
37 => 2300000,
38 => 2530000,
39 => 2700000,
40 => 2928000,
41 => 3142000,
42 => 3378000,
43 => 3604000,
44 => 3852000,
45 => 4090000,
46 => 4350000,
47 => 4600000,
48 => 4872000,
49 => 5134000,
50 => 5400000); |
Then I edited my rank out section to this
| Quote: | echo ' <td align="center"><img src="modules/'.$module_name.'/images/Ranks/thumb/'.$stats[$out]['rank'].'.png" alt="'.$stats[$out]['rank'].'" /><br /><img src="modules/'.
$module_name.'/progress.php?max=/'.$stats[$out]['diff_score']. '&current=' . $stats[$out]['score_rank']. '&color=ff7700&bgcolor=2E2E2E" /></td>'; | I will post the progress.php at the end of this reply.
next I added this after the "//calculate which class they use" section
| Quote: | // Search next rank
if( empty($rankpoints[($data['players'][$x]['rank'] + 1)]) )
$nextRankID = $data['players'][$x]['rank'];
else {
if($rankpoints[$data['players'][$x]['rank']] == $rankpoints[($data['players'][$x]['rank'] + 1)])
{
$nextRankID = 0;
for ($m=($data['players'][$x]['rank'] + 1);$m<(count($rankpoints)-1);$m++)
{
if( ($rankpoints[$m] > $rankpoints[$data['players'][$x]['rank']]) && ($nextRankID == 0) ) $nextRankID = $m;
}
}
else $nextRankID = ($data['players'][$x]['rank'] + 1);
}
$score_rank = $data['players'][$x]['score'] - $rankpoints[$nextRankID-1];
$diff_score = $rankpoints[$nextRankID] - $rankpoints[$nextRankID-1];
|
and last I added this to the "$stats[$x] = "
| Quote: | | ,'score_rank'=> $score_rank,'diff_score'=> $diff_score); |
I have no idea what I am doing wrong here ( code works as intended in my block ) any help would be much appreciated.
progress.php
| Quote: | <?php
header("Content-type: image/png");
if(isset($_GET['max']) && isset($_GET['current'])) {
$maxPoints = $_GET['max'];
$curPoints = $_GET['current'];
// Last Rank reached?
if($maxPoints == "0") $maxPoints = $curPoints;
// Convert Color
$color_r = hexdec( substr($_GET['color'], 0, 2) );
$color_g = hexdec( substr($_GET['color'], 2, 2) );
$color_b = hexdec( substr($_GET['color'], 4, 2) );
$bgcolor_r = hexdec( substr($_GET['bgcolor'], 0, 2) );
$bgcolor_g = hexdec( substr($_GET['bgcolor'], 2, 2) );
$bgcolor_b = hexdec( substr($_GET['bgcolor'], 4, 2) );
// Create image
$im = @imagecreate(75, 4); //file size of the picture
$background_color = imagecolorallocate($im, $bgcolor_r, $bgcolor_g, $bgcolor_b);
if(empty($maxPoints) || empty($curPoints)) exit;
if($curPoints > $maxPoints) $curPoints = $maxPoints;
$iColor = imagecolorallocate($im, $color_r, $color_g, $color_b);
$BarWidth = number_format(floor(($curPoints / $maxPoints) * 75),0); //length of the bar 55
if($BarWidth<1) $BarWidth = 1;
imagefilledrectangle( $im, 1, 1, $BarWidth, 2, $iColor );
imagepng($im);
imagedestroy($im);
} else {
exit;
}
?> |
|
|
|
| Back to top |
|
 |
SgtLegend Site Admin
 Lead Developer
 DFG Developer

Gender:  Joined: Oct 11, 2008 Age: 22 Posts: 5058 Location: Australia Reputation: 602.2   votes: 27

Status: Offline
Web Control Panel: WHM |
Posted: Thu Apr 08, 2010 5:05 pm Post subject: Re: Bad Company 2 Stats block |
|
|
Sorry forgot to let you know which file to update
Update the index.php file in the admin folder
@TONY[-TOC-]
Ill have a look at the coding when i get home in about 6 hours |
DFG Hosting | DFG Design | Stack Overflow | PHP.net | jQuery | CSS-Tricks | !DOCTYPE | Mozilla Docs
Current projects: Nuke Evolution Xtreme (Unknown)
I am a front end web developer that knows PHP and MySQL, also a SitePoint Mentor
 |
|
| Back to top |
|
 |
TONY[-TOC-]
Joined: May 20, 2009 Posts: 242
Reputation: 31.3   votes: 1

Status: Offline
|
Posted: Thu Apr 08, 2010 5:12 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| Quote: | @TONY[-TOC-]
Ill have a look at the coding when i get home in about 6 hours
|
Thank you sir. I am in over my head on it. |
|
|
| Back to top |
|
 |
Sponsor
|
|
 |
Bassinurface
Joined: Jun 26, 2009 Posts: 82 Location: USA Reputation: 10.3  

Status: Offline
|
Posted: Thu Apr 08, 2010 5:22 pm Post subject: Re: Bad Company 2 Stats block |
|
|
0 players information failed to update!
[ Go Back And Try Again ]
That's is what I get now? |
|
|
| Back to top |
|
 |
denzil3009
Gender:  Joined: Mar 07, 2009 Posts: 490 Location: Edinburgh Reputation: 44.5   votes: 4

Status: Offline
Web Control Panel: Plesk 9.0 Test: >:/ |
Posted: Thu Apr 08, 2010 5:29 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| That means all players got updated ? |
|
|
| Back to top |
|
 |
Bassinurface
Joined: Jun 26, 2009 Posts: 82 Location: USA Reputation: 10.3  

Status: Offline
|
Posted: Thu Apr 08, 2010 5:31 pm Post subject: Re: Bad Company 2 Stats block |
|
|
No when I try to add them it fails and this what it tells me
"0 players information failed to update!
[ Go Back And Try Again ]" |
|
|
| Back to top |
|
 |
Sponsor
|
|
 |
denzil3009
Gender:  Joined: Mar 07, 2009 Posts: 490 Location: Edinburgh Reputation: 44.5   votes: 4

Status: Offline
Web Control Panel: Plesk 9.0 Test: >:/ |
Posted: Thu Apr 08, 2010 6:01 pm Post subject: Re: Bad Company 2 Stats block |
|
|
Did you install the sql ?
if you had the old back installed you will need to delete the old table. |
|
|
| Back to top |
|
 |
Bassinurface
Joined: Jun 26, 2009 Posts: 82 Location: USA Reputation: 10.3  

Status: Offline
|
Posted: Thu Apr 08, 2010 6:35 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| Nothing.... I can add them through myphpadmin but not through the mod itself |
|
|
| Back to top |
|
 |
denzil3009
Gender:  Joined: Mar 07, 2009 Posts: 490 Location: Edinburgh Reputation: 44.5   votes: 4

Status: Offline
Web Control Panel: Plesk 9.0 Test: >:/ |
Posted: Thu Apr 08, 2010 7:13 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| Have you done the jQuery edits ? |
|
|
| Back to top |
|
 |
Sponsor
|
|
 |
Bassinurface
Joined: Jun 26, 2009 Posts: 82 Location: USA Reputation: 10.3  

Status: Offline
|
Posted: Thu Apr 08, 2010 7:18 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| Yuppers |
|
|
| Back to top |
|
 |
NEO
Gender:  Joined: Dec 28, 2008 Posts: 77
Reputation: 6.8  

Status: Offline
|
Posted: Thu Apr 08, 2010 7:31 pm Post subject: Re: Bad Company 2 Stats block |
|
|
Since there are multiple downloads in this thread, would someone post the link to the latest and greatest version that SgtLegend has been working on?
This is getting a little confusing as there are two different MODULES ("BC2_stats_tracker" which is in this thread and "BFBC2_Stats_Tracker_Module_1.0_RC1" which is in the Downloads section of the web site). Both of these modules use the same database name.
Thank you
NEO |
|
|
| Back to top |
|
 |
denzil3009
Gender:  Joined: Mar 07, 2009 Posts: 490 Location: Edinburgh Reputation: 44.5   votes: 4

Status: Offline
Web Control Panel: Plesk 9.0 Test: >:/ |
Posted: Thu Apr 08, 2010 8:03 pm Post subject: Re: Bad Company 2 Stats block |
|
|
Bassinyourface try deleting the table and reinstalling
@NEO
download the one in the downloads section of this site, you are correct though.
SGT-Legend should include a DELETE statement in the install SQL if he hasnt already. |
|
|
| Back to top |
|
 |
Sponsor
|
|
 |
SgtLegend Site Admin
 Lead Developer
 DFG Developer

Gender:  Joined: Oct 11, 2008 Age: 22 Posts: 5058 Location: Australia Reputation: 602.2   votes: 27

Status: Offline
Web Control Panel: WHM |
Posted: Thu Apr 08, 2010 8:46 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| Bassinurface wrote (View Post): | No when I try to add them it fails and this what it tells me
"0 players information failed to update!
[ Go Back And Try Again ]" |
This should only happen if the table doesn't exist
| denzil3009 wrote (View Post): | | SGT-Legend should include a DELETE statement in the install SQL if he hasnt already. |
I don't see the need for one as i changed the table name with the download
| NEO wrote (View Post): |
Since there are multiple downloads in this thread, would someone post the link to the latest and greatest version that SgtLegend has been working on?
This is getting a little confusing as there are two different MODULES ("BC2_stats_tracker" which is in this thread and "BFBC2_Stats_Tracker_Module_1.0_RC1" which is in the Downloads section of the web site). Both of these modules use the same database name.
Thank you
NEO
|
The one i update will always be in the downloads module so it didn't get confusing |
DFG Hosting | DFG Design | Stack Overflow | PHP.net | jQuery | CSS-Tricks | !DOCTYPE | Mozilla Docs
Current projects: Nuke Evolution Xtreme (Unknown)
I am a front end web developer that knows PHP and MySQL, also a SitePoint Mentor
 |
|
| Back to top |
|
 |
killigan Xtreme Developer
 DFG Developer

Gender:  Joined: Oct 08, 2008 Posts: 2425
Reputation: 35009.9   votes: 6

Status: Offline
|
Posted: Thu Apr 08, 2010 9:51 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| there is an option to uninstall the module in the installer. Instead of clicking new install you can click on uninstall and it will delete the tables. |
Thanks,
Killigan
DfgHosting.com - a true hosting company since 2006
Shared Hosting | Reseller Hosting | Dedicated Servers
 |
|
| Back to top |
|
 |
denzil3009
Gender:  Joined: Mar 07, 2009 Posts: 490 Location: Edinburgh Reputation: 44.5   votes: 4

Status: Offline
Web Control Panel: Plesk 9.0 Test: >:/ |
Posted: Thu Apr 08, 2010 11:06 pm Post subject: Re: Bad Company 2 Stats block |
|
|
| killigan wrote (View Post): | | there is an option to uninstall the module in the installer. Instead of clicking new install  you can click on uninstall and it will delete the tables. |
I never use the installers
I prefer phpmyadmin  |
|
|
| Back to top |
|
 |
Sponsor
|
|
 |
|