
ajack38
Members-
Posts
8 -
Joined
-
Last visited
ajack38's Achievements
Newbie (1/14)
0
Reputation
-
<?php $macropage="gym.php"; include "globals.php"; 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(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 "You begin lifting some weights.<br /> You have gained {$gain} strength by doing {$_POST['amnt']} sets of weights.<br /> You now have {$inc} strength and {$inc2} energy left."; } elseif($stat=="agility") { print "You begin running on a treadmill.<br /> You have gained {$gain} agility by doing {$_POST['amnt']} minutes of running.<br /> You now have {$inc} agility and {$inc2} energy left."; } elseif($stat=="guard") { print "You jump into the pool and begin swimming.<br /> You have gained {$gain} guard by doing {$_POST['amnt']} minutes of swimming.<br /> 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.<br /> You have gained {$gain} labour by moving {$_POST['amnt']} boxes.<br /> You now have {$inc} labour and {$inc2} energy left."; } print "<hr />"; $ir['energy']-=$_POST['amnt']; $ir[$stat]+=$gain; } } print "Choose the stat you want to train and the times you want to train it.<br /> 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']}) <option style='color:blue;' value='Agility'>Agility (Have {$ir['agility']}) <option style='color:green;' value='Guard'>Guard (Have {$ir['guard']}) <option style='color:brown;' value='Labour'>Labour (Have {$ir['labour']}) </select><br /> Times to train: <input type='text' name='amnt' value='{$ir['energy']}' /><br /> <input type='submit' value='Train' /></form>"; $h->endpage(); ?>
-
Whoa, Thanks Guys. So much help here. I will try to add that and see what happens.
-
1. Is there a way to remove that increase? 2. I can't find the post variable, If I were to post the code would you be able to help?
-
I've looked through the code for about 20 minutes and It is confusing, it states that It uses 'amnt' but I can't find it where is creates the 'amnt'.
-
I was wondering if there would be a way for me to change the amount of energy used when training in the gym. It currently uses 1 energy but I would like to change it to 5. Would somebody be able to provide me with a guide on how to do this? Thanks in advance, Ashley Jackson
-
Okay, I've got all the Mysql working and now it is just the PHP that is annoying me. I am reading about it on a few websites and I'm slowly starting to understand it, but a few pieces of code aren't working. This is the code for one of my pages and it comes up with the error: Parse error: syntax error, unexpected '/' in /home/crimecit/public_html/criminal.php on line 14 <?php $macropage="criminal.php"; include "globals.php"; if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } $q2=$db->query("SELECT * FROM crimes ORDER BY crimeBRAVE ASC"); while ($r2=$db->fetch_row($q2)) { $crimes[]=$r2; } $q=$db->query("SELECT * FROM crimegroups ORDER by cgORDER ASC"); print "<b>Criminal Centre</b><br /> <tbody><tr> <td bgcolor="#999999" colspan="3"><div align="center"><strong>Crime</strong></div></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('1').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/a.png"></td> <td><b> Search for cash</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-2 Nerve</span> </td> <td width="35"><center><input id="1" type="RADIO" name="crime" value="searchstreets" checked=""> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('2').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/b.png"></td> <td><b> Sell copied media</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-3 Nerve</span> </td> <td width="35"><center><input id="2" type="RADIO" name="crime" value="sellcopiedcds"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('3').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/c.png"></td> <td><b> Shoplift</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-4 Nerve</span> </td> <td width="35"><center><input id="3" type="RADIO" name="crime" value="shoplift"> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('4').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/d.png"></td> <td><b> Pickpocket someone</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-5 Nerve</span> </td> <td width="35"><center><input id="4" type="RADIO" name="crime" value="pickpocket"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('5').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/e.png"></td> <td><b> Larceny</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-6 Nerve</span> </td> <td width="35"><center><input id="5" type="RADIO" name="crime" value="larceny"> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('6').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/f.png"></td> <td><b> Armed Robberies</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-7 Nerve</span> </td> <td width="35"><center><input id="6" type="RADIO" name="crime" value="robsweetshop"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('7').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/g.png"></td> <td><b> Transport drugs</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-8 Nerve</span> </td> <td width="35"><center><input id="7" type="RADIO" name="crime" value="transportdrugs"> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('8').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/h.png"></td> <td><b> Plant a computer virus</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-9 Nerve</span> </td> <td width="35"><center><input id="8" type="RADIO" name="crime" value="virus"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('9').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/i.png"></td> <td><b> Assassination</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-10 Nerve</span> </td> <td width="35"><center><input id="9" type="RADIO" name="crime" value="assasination"> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('10').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/j.png"></td> <td><b> Arson</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-11 Nerve</span> </td> <td width="35"><center><input id="10" type="RADIO" name="crime" value="arson"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('11').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/k.png"></td> <td><b> Grand Theft Auto</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-12 Nerve</span> </td> <td width="35"><center><input id="11" type="RADIO" name="crime" value="gta"> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('12').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/l.png"></td> <td><b> Pawn Shop</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-13 Nerve</span> </td> <td width="35"><center><input id="12" type="RADIO" name="crime" value="pawnshop"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('13').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/m.png"></td> <td><b> Counterfeiting</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-14 Nerve</span> </td> <td width="35"><center><input id="13" type="RADIO" name="crime" value="counterfeiting"> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('14').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/n.png"></td> <td><b> Kidnapping</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-15 Nerve</span> </td> <td width="35"><center><input id="14" type="RADIO" name="crime" value="kidnapping"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('15').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/o.png"></td> <td><b> Arms Trafficking</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-16 Nerve</span> </td> <td width="35"><center><input id="15" type="RADIO" name="crime" value="armstraffic"> </center></td> </tr> <tr bgcolor="#CCCCCC" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#CCCCCC'" onclick="document.getElementById('16').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(204, 204, 204); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/p.png"></td> <td><b> Bombings</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-17 Nerve</span> </td> <td width="35"><center><input id="16" type="RADIO" name="crime" value="bombings"> </center></td> </tr> <tr bgcolor="#DFDFDF" onmouseover="this.style.background='#AABBCC';this.style.cursor='pointer'" ;="" onmouseout="this.style.background='#DFDFDF'" onclick="document.getElementById('17').checked=true; document.crimes.submit();" style="cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; "> <td width="1%"><img src="/images/crimes/q.png"></td> <td><b> Hacking</b> <br> <span style="font-family: Arial; font-size: 9; color:#CC0000 ">-18 Nerve</span> </td> <td width="35"><center><input id="17" type="RADIO" name="crime" value="hacking"> </center></td> </tr><tr bgcolor="#999999"> <td colspan="3"><div align="center"><input name="docrime" type="submit" id="docrime" value="Next Step"></div></td> </tr></tbody> while($r=$db->fetch_row($q)) { print "<tr><td colspan='3' class='h'>{$r['cgNAME']}</td></tr>"; foreach($crimes as $v) { if($v['crimeGROUP'] == $r['cgID']) { print "<tr><td>{$v['crimeNAME']}</td><td>{$v['crimeBRAVE']} Brave</td><td><a href='docrime.php?c={$v['crimeID']}'>Do</a></td></tr>"; } } } print "</table>"; $h->endpage(); ?>
-
@Newttster. That's exactly what I have to in the php. @ShadyCoco. I knew that I had to add "donatordays" to the database but I wasn't sure what fields need to be placed there and what details needed to be added in. Is there anyone here that would be able to help with the .sql code to create the table and all relevant information for "donatordays"? This is an example code that I pulled from a random website, I'm not sure what to add. So if anyone can help with this I will appreciate it so much. Thanks in advance. -- -------------------------------------------------------- -- -- Table structure for table `donatordays` -- CREATE TABLE `donatordays` ( `*****` int(11) NOT NULL auto_increment, `*****` int(11) NOT NULL default '0', `****` int(11) NOT NULL default '0', `***` int(11) NOT NULL default '0', PRIMARY KEY (`*****`) ) ENGINE=***** ; EDIT: :D I got it working, Now I just got to get all the Mysql to work. Anyone willing to help me out? I'll have to give you a bit of control over the Php Admin.
-
"donatorday" Not building correctly Hey, I kinda feel like an ass for reopening this dead topic but I am currently having a problem that is similar to this. I've run ~/installer.php I've filled it out perfectly and then it comes to this. Write Config... Config written. Attempting DB connection Connection Successful. Writing Main MySQL data. Main MySQL data was written. Now write Extra MySQL data. QUERY ERROR: Unknown column 'donatordays' in 'field list' Query was INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '*****', '*****', md5('********'), 1, 100, 0, 0, 2, 12, 12, 100, 100, 5, 5, 100, 100, 1, '', unix_timestamp(), '*******', -1, '*******', '*******') Now from what I have gotten from this is that in the .sql there is no section in where it creates the donatordays table. What I've written might be wrong so if anyone else knows how to fix it then can you reply? Also, to everyone else. Yes, I have Removed all tables and rerun the installer at least 10 times. I just have a feeling that my .sql is missing some piece of code. I'll post it here so if anyone notices anything missing could you just shout out with the fix? Cheers. Code: http://pastebin.com/v7t9YvVT