_Ricky_ Posted January 14, 2009 Share Posted January 14, 2009 if i wanted to add 1 percent per train...not 1 but 1 percent....how would it be done Quote Link to comment Share on other sites More sharing options...
Lithium Posted January 14, 2009 Share Posted January 14, 2009 Re: gym exp gain=experience+(experience*0.01) something along these lines Quote Link to comment Share on other sites More sharing options...
_Ricky_ Posted January 14, 2009 Author Share Posted January 14, 2009 Re: gym exp $db->query("UPDATE `users` SET `exp` = `exp` + '*0.01' WHERE `userid` = $userid"); this is what i have and its just not giveing any exp Quote Link to comment Share on other sites More sharing options...
Lithium Posted January 14, 2009 Share Posted January 14, 2009 Re: gym exp $db->query("UPDATE `users` SET `exp` = exp+(exp*0.01) WHERE `userid` = $userid"); but then... this is not where stats are changed, maybe userstats should be correct no? Quote Link to comment Share on other sites More sharing options...
_Ricky_ Posted January 14, 2009 Author Share Posted January 14, 2009 Re: gym exp never gave any either Quote Link to comment Share on other sites More sharing options...
Eternal Posted January 14, 2009 Share Posted January 14, 2009 Re: gym exp where it says $gain=round(rand(1,3)/rand(700,800)*rand(700,800)*(($ir['will']+20)/200)); In that section put $egain=$gain/30; then add to the query ,exp=exp+$egain Modify to your liking.... Quote Link to comment Share on other sites More sharing options...
jds137 Posted January 14, 2009 Share Posted January 14, 2009 Re: gym exp I wasnt sure where to add it, here is my gym code... <?php $macropage="gym.php"; include "globals.php"; include "travellingglobals.php"; if($ir['gympass']== 0) { die("You do not have a gym club membership, [url='passesshop.php']Buy a Gym Pass[/url]"); } if($ir['hospital']) { die("This page cannot be accessed while in hospital."); } $statnames=array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'Labour' => 'labour'); $_POST['amnt']=abs((int) $_POST['amnt']); if(!$ir['jail']) { print "<h3>Gym</h3><hr />"; } else { print "<h3>Jail Gym</h3><hr />"; } if($_POST['stat'] && $_POST['amnt']) { $stat=$statnames[$_POST['stat']]; if(!$stat) { die("This stat cannot be trained."); } if($_POST['amnt'] > $ir['energy']) { print("You do not have enough energy to train that much.<hr />"); } else { $gain=0; for($i=0; $i<$_POST['amnt']; $i++) { $gain+=rand(1,3)/rand(8000,10000)*rand(8000,10000)*(($ir['will']+20)/150); $ir['will']-=rand(1,2); if($ir['will'] < 0) { $ir['will']=0; } } if($ir['prison']) { $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 "You begin lifting some weights. You have gained {$gain} strength by doing {$_POST['amnt']} sets of weights. You now have {$inc} strength and {$inc2} energy left."; } elseif($stat=="agility") { print "You begin running on a treadmill. You have gained {$gain} agility by doing {$_POST['amnt']} minutes of running. You now have {$inc} agility and {$inc2} energy left."; } elseif($stat=="guard") { print "You jump into the pool and begin swimming. You have gained {$gain} guard by doing {$_POST['amnt']} minutes of swimming. You now have {$inc} guard and {$inc2} energy left."; } elseif($stat=="labour") { print "You walk over to some boxes filled with gym equipment and start moving them. You have gained {$gain} labour by moving {$_POST['amnt']} boxes. You now have {$inc} labour and {$inc2} energy left."; } print "<hr />"; $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'); print "Choose the stat you want to train and the times you want to train it. You can train up to {$ir['energy']} times.<hr /> <form action='gym.php' method='post'> Stat: <select type='dropdown' name='stat'> <option style='color:red;' value='Strength'>Strength (Have {$ir['strength']}, Ranked {$ir['strank']}) <option style='color:blue;' value='Agility'>Agility (Have {$ir['agility']}, Ranked {$ir['agirank']}) <option style='color:green;' value='Guard'>Guard (Have {$ir['guard']}, Ranked {$ir['guarank']}) <option style='color:brown;' value='Labour'>Labour (Have {$ir['labour']}, Ranked {$ir['labrank']}) </select> Times to train: <input type='text' name='amnt' value='{$ir['energy']}' /> <input type='submit' value='Train' /></form>"; $h->endpage(); ?> 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.