boots Posted February 15, 2012 Share Posted February 15, 2012 Hi i have changed my tables in user stats and all is well, stats show ok in the DB but ingame they still show with 2bill cap how can i change this ? strength agility and gaurd set at decimal(13,0) and all stats show ok in the tables please help Quote Link to comment Share on other sites More sharing options...
skooda Posted February 15, 2012 Share Posted February 15, 2012 I did something like this send me your files Quote Link to comment Share on other sites More sharing options...
boots Posted February 15, 2012 Author Share Posted February 15, 2012 which files do you want ? Quote Link to comment Share on other sites More sharing options...
skooda Posted February 15, 2012 Share Posted February 15, 2012 Send me your back up gym and the one your trying to edit Quote Link to comment Share on other sites More sharing options...
Spudinski Posted February 15, 2012 Share Posted February 15, 2012 Hi i have changed my tables in user stats and all is well, stats show ok in the DB but ingame they still show with 2bill cap how can i change this ? strength agility and gaurd set at decimal(13,0) and all stats show ok in the tables please help Decimal? Ok. I would've suggestion BIGINT, unless you need floats. Quote Link to comment Share on other sites More sharing options...
boots Posted February 15, 2012 Author Share Posted February 15, 2012 yeah BIGINT would work as well, but the prob don't seem to be with the DB as the higher stats show, but in game they show with the 2 bill cap Quote Link to comment Share on other sites More sharing options...
boots Posted February 15, 2012 Author Share Posted February 15, 2012 Gym.php <?php $macropage="gym.php"; require "globals.php"; if($ir['hospital']) { die("<prb>This page cannot be accessed while in hospital.</prb>"); } $statnames=array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'Labour' => 'labour'); $_POST['amnt']=abs((int) $_POST['amnt']); if(!$ir['jail']) { print "<div class='gympage'> <div class='gympart'> <div class='gymtxt'><img src='images/gym_txt.jpg' alt='' /></div> </div>"; } else { print " <div class='gympage'> <div class='gympart'></div> "; } if($_POST['stat'] && $_POST['amnt']) { $stat=$statnames[$_POST['stat']]; if(!$stat) { die("<prb><br>This stat cannot be trained.</prb>"); } if($_POST['amnt'] > $ir['energy']) { print("<prb><font color='red'>You do not have enough energy to train that much.</font></prb>"); } else { $gain=0; for($i=0; $i<$_POST['amnt']; $i++) { $gain+=rand(1,3)/rand(800,1000)*rand(800,1000)*(($ir['will']+20)/150); $ir['will']-=rand(1,3); if($ir['will'] < 0) { $ir['will']=0; } } if($ir['jail']) { $gain/=2; } $db->query("UPDATE `userstats` SET `{$stat}` = `{$stat}` + $gain WHERE `userid` = $userid"); $db->query("UPDATE `users` SET `will` = {$ir['will']}, energy = energy - {$_POST['amnt']} WHERE `userid` = $userid"); $inc=$ir[$stat]+$gain; $inc2=$ir['energy']-$_POST['amnt']; if($stat=="strength") { print " <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px; margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'> You start to lift some weights, You go heavier and heavier until You are out of energy.<br /> You have gained {$gain} strength by doing {$_POST['amnt']} sets of weights.<br /> You now have {$inc} strength and {$inc2} energy left. </div></div> "; } elseif($stat=="agility") { print " <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px; margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'> You Begin to run on the treadmill, You keep tapping the faster button till you fly off the damn thing!.<br /> You have gained {$gain} agility by doing {$_POST['amnt']} minutes of running.<br /> You now have {$inc} agility and {$inc2} energy left. </div></div> "; } elseif($stat=="guard") { print " <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px; margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'> You jump into the pool and begin swimming, you keep flapping your arms in the water like Michael Felps, you get a cramp and almost drown.<br /> You have gained {$gain} guard by doing {$_POST['amnt']} minutes of swimming.<br /> You now have {$inc} guard and {$inc2} energy left. </div></div> "; } elseif($stat=="labour") { print " <div id='mainOutput' style='text-align: center; color: green; width: 600px; border: 1px solid #222222; height: 70px; margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'> You walk over to the front desk, and ask the manager If you can volunteer to help the gym out, He says unload the boxes In the back, You unload boxes until the gym closes<br /> You have gained {$gain} labour by unloading {$_POST['amnt']} boxes.<br /> You now have {$inc} labour and {$inc2} energy left. </div></div> "; } $ir['energy']-=$_POST['amnt']; $ir[$stat]+=$gain; } } $ir['strank']=get_rank($ir['strength'],'strength'); $ir['agirank']=get_rank($ir['agility'],'agility'); $ir['guarank']=get_rank($ir['guard'],'guard'); $ir['labrank']=get_rank($ir['labour'],'labour'); if( $ir['energy'] == "0" ) { print " <table width='90%'><tr><td><p> You dont have any energy for taining <a href='crystaltemple.php?spend=refill'><font color='green'>[Refill Energy]</font></a></p></td></tr></table> <br /> "; } else { print " <table width='90%'><tr><td><p> You can train up to <prb> {$ir['energy']} </prb> times with your current energy.</p></td></tr></table> <br />"; } print " <table width='90%' class='table'> <tr> <form action='gym.php' method='post'> <input type='hidden' name='stat' value='Strength'></input> <th width='15%'><ph2>Strength:</ph2></th> <td width='15%'>{$ir['strength']}</td> <td width='10%'>Rank {$ir['strank']}</td> <td width='40%'>Times to train: <input name='amnt' type='text' style='color: black;background-color: white;' value='{$ir['energy']}' > </input> </td> <td width='20%'> <input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td> </form> </tr> <tr> <form action='gym.php' method='post'> <input type='hidden' name='stat' value='Agility'></input> <th width='15%'><ph2>Agility:</ph2></th> <td width='15%'>{$ir['agility']}</td> <td width='10%'>Rank {$ir['agirank']}</td> <td width='40%'>Times to train: <input type='text' style='color: black; background-color: white;' name='amnt' value='{$ir['energy']}'></input></td> <td width='20%'><input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td> </form> </tr> <tr> <form action='gym.php' method='post'> <input type='hidden' name='stat' value='Guard'></input> <th width='15%'><ph2>Guard:</ph2></th> <td width='15%'>{$ir['guard']}</td> <td width='10%'>Rank {$ir['guarank']}</td> <td width='40%'>Times to train: <input type='text' style='color: black; background-color: white;' name='amnt' value='{$ir['energy']}'></input></td> <td width='20%'><input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td> </form> </tr> <tr> <form action='gym.php' method='post'> <input type='hidden' name='stat' value='Labour'></input> <th width='15%'><ph2>Labour:</ph2></th> <td width='15%'>{$ir['labour']}</td> <td width='10%'>Rank {$ir['labrank']}</td> <td width='40%'>Times to train: <input type='text' style='color: black; background-color: white;' name='amnt' value='{$ir['energy']}'></input></td> <td width='20%'><input type=image name='submit' src='images/trainbtn.jpg' alt='Home' border='0''> </input> </td> </form> </tr> </table><br />"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
boots Posted February 21, 2012 Author Share Posted February 21, 2012 still having the same prob can some-one please help Quote Link to comment Share on other sites More sharing options...
peterisgb Posted February 21, 2012 Share Posted February 21, 2012 only thing i would suggest is go into your phpmyadmin (if thats what your using) and change all your stats in BIGINT 55 this is what i did to overcome the limits. Quote Link to comment Share on other sites More sharing options...
boots Posted February 23, 2012 Author Share Posted February 23, 2012 Already done that, my stats show in the database,so i dont think the prob is there,maybe wrong i dont know Im lost,it just ingame where the stats dont show it caps at 2.1 bill :( Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted February 23, 2012 Share Posted February 23, 2012 Where do you have stats showing index.php? Might have (int) in there somewhere preventing it from displaying right or something along the lines, post the part that echo's the players stats. Quote Link to comment Share on other sites More sharing options...
boots Posted February 25, 2012 Author Share Posted February 25, 2012 <br><table width=90% border=0 height='150' class=table3 style= text-align:center; >"; $ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['robskill']+$ir['IQ']; $ir['strank']=get_rank($ir['strength'],'strength'); $ir['agirank']=get_rank($ir['agility'],'agility'); $ir['guarank']=get_rank($ir['guard'],'guard'); $ir['labrank']=get_rank($ir['labour'],'labour'); $ir['robrank']=get_rank($ir['robskill'],'robskill'); $ir['IQrank']=get_rank($ir['IQ'],'IQ'); $tsrank=get_rank($ts,'strength+agility+guard+labour+IQ'); $ir['strength']=number_format($ir['strength']); $ir['agility']=number_format($ir['agility']); $ir['guard']=number_format($ir['guard']); $ir['labour']=number_format($ir['labour']); $ir['robskill']=number_format($ir['robskill']); $ir['IQ']=number_format($ir['IQ']); $ts=number_format($ts); this is my stat info from index.php </tr>"; $exp=(int)($ir['exp']/$ir['exp_needed']*100); print "<tr> <td width=50%><b>Name:</b> {$ir['username']}</td><td><b>Crystals:</b> {$cm}</td></tr><tr> <td><b>Level:</b> {$ir['level']}</td> <td><b>Exp:</b> {$exp}%</td></tr><tr> <td><b>Money:</b> $fm</td> <td><b> Gang:</b> "; $qs=$db->query("SELECT * FROM gangs WHERE gangID={$ir['gang']}"); $rs=$db->fetch_row($qs); if(!$db->num_rows($qs) ) this is the only bit i can find int unless im missing somthing Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted February 25, 2012 Share Posted February 25, 2012 Check your number_format function that's where your problem is. Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted February 26, 2012 Share Posted February 26, 2012 Boots in any file which shows your stats. Go through it and find any occurrence of "(int)" and take it out. Quote Link to comment Share on other sites More sharing options...
newttster Posted February 26, 2012 Share Posted February 26, 2012 Check your number_format function that's where your problem is. I have mine set up pretty much the same way. The number_format function is fine in this case, I believe. Quote Link to comment Share on other sites More sharing options...
boots Posted February 27, 2012 Author Share Posted February 27, 2012 Check your number_format function that's where your problem is. whats wrong with the number_format function ? Lucky Taken out( int) in index.php still no change gym stats show as they should just index.php seems to be the prob, Quote Link to comment Share on other sites More sharing options...
boots Posted February 27, 2012 Author Share Posted February 27, 2012 if i take out $ir['strength']=number_format($ir['strength']); $ir['agility']=number_format($ir['agility']); $ir['guard']=number_format($ir['guard']); i dont understand what these line do, do i just leave them ? Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted February 27, 2012 Share Posted February 27, 2012 PHP's default precision is 14. Therefore the maximum number it can handle w/o loosing precision is 99,999,999,999,999.0(99 trillion) (without decimal places that is). The more decimal places you the lower your whole number precision gets. With that being said if the number in your db is higher than the number above or has more number places than the number above, then you will need to use a different method of showing, reading, and manipulating the numbers. If the number is not larger than the above number then the problem is being caused by an action being performed on the number. The problem is not with number_format's max precision is the same as php's so that will not be the problem unless the number as more places than the number above. The maximum signed value for an integer is 21bill and something. Therefore when you typecast to an integer you will get an (silent) error if the number is above 21 and some billion. So all you have to do is this. Change something like this: $strength=(int) a+(b*c); To... $strength=a+(b*c); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.