Godhand Posted October 8, 2007 Posted October 8, 2007 I was trying to make a new gym for donators with more than 400 donator days I kept getting: Parse error: syntax error, unexpected '<' in /home/site/my_html/superdgym.php on line 4 <?php $macropage="superdgym.php"; include "globals.php"; if($ir['donatordays']=>400) die("Donators only"); $statnames=array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'Labour' => 'labour'); $_POST['amnt']=abs((int) $_POST['amnt']); if(!$ir['jail']) { print " Donator Gym"; } else { print "Donator Jail Gym"; } 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."); } else { $gain=0; for($i=0; $i<$_POST['amnt']; $i++) { $gain+=rand(1,3)/rand(6550,(9850)*rand(5949,8051)*(($ir['will']*1.3+11000)/200); $ir['will']-=rand(1,3); if($ir['will'] < 1000) { $ir['will']=1000; } } 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 "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 ""; $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. Stat: Strength (Have {$ir['strength']}, Ranked {$ir['strank']}) Agility (Have {$ir['agility']}, Ranked {$ir['agirank']}) Guard (Have {$ir['guard']}, Ranked {$ir['guarank']}) Labour (Have {$ir['labour']}, Ranked {$ir['labrank']}) Times to train: "; $h->endpage(); ?> Quote
Guest Anonymous Posted October 8, 2007 Posted October 8, 2007 Re: v2 Gym problem if($ir['donatordays']=>400) Quote
hamster01 Posted October 8, 2007 Posted October 8, 2007 Re: v2 Gym problem Change if($ir['donatordays']=>400) die("Donators only"); To if ($ir['donatordays'] <= 400) { echo 'Donators Only'; $h->endpage(); exit; } Quote
UCC Posted October 8, 2007 Posted October 8, 2007 Re: v2 Gym problem Since nobody is pointing out exactly where you are confused The format is <= Or >= = Always goes second Quote
UCC Posted October 8, 2007 Posted October 8, 2007 Re: v2 Gym problem I want to know what 400 days has to do with the price of tea in china Quote
Godhand Posted October 9, 2007 Author Posted October 9, 2007 Re: v2 Gym problem lol the reason it was posted like that was because I was trying to figure out other ways and I 'forgot' to check that. But thanks for the clarification. At least now I understand why I went wrong.(edit: there it doesn't restore the will) <?php $macropage="superdgym.php"; include "globals.php"; if ($ir['donatordays'] <= 400) die("Super donators only"); $statnames=array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'Labour' => 'labour'); $_POST['amnt']=abs((int) $_POST['amnt']); if(!$ir['jail']) { print "<h3> Donator super Gym</h3><hr />"; } else { print "<h3>Donator Jail super 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(7550,14850)*rand(7949,8051)*(($ir['will']*1.7+15000)/300); $ir['will']-=rand(1,3); if($ir['will'] < 500) { $gain+=rand(1,3)/rand(7550,14850)*rand(7949,8051)*((500*1.7+15000)/300); ; } 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 `exp` = (`exp`+$gain/20) 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='superdgym.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(); ?> if you name the file superdgym.php of course if you rename it make the changes that are according to the name. Thanks for the help. +1 to both of you for clarifying Quote
HITMAN 17 Posted November 18, 2007 Posted November 18, 2007 Re: v2 Gym problem the gym is use full but y does it make will 1000 Quote
Godhand Posted November 19, 2007 Author Posted November 19, 2007 Re: v2 Gym problem Because I wasn't sure how to make it record it otherwise (to make it more desirable) . BUT I do have it patched up now in my game. I have for a while now. Quote
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.