Jump to content

Gym Problem -- 100 Max Energy!


Recommended Posts

Well - I bought a mod which requires 100 Max Energy but donators can have 150 Max Energy - But in my Gym I need to kind of "Convert" it so it fits the mod..

The problem is: It says "Times to Train" and a 0 in the box - Whereas I check my Energy Bar - I have 50 Energy Left -- And If i hit F5 it continues to train and starts going into MINUS numbers.

Here is my attempt at doing it myself (Yes im posting the whole code to the V2 Gym..)


include "globals.php";
if($ir['hospital']) { die("This page cannot be accessed while Injured in Action."); }
'Strength' => 'strength',
'Agility' => 'agility',
'Guard' => 'guard',
'Labour' => 'labour');
$_POST['amnt']=abs((int) $_POST['amnt']);
print "<h3>Gym</h3><hr />";
 print "<h3>Jail Gym</h3><hr />";
if($_POST['stat'] && $_POST['amnt'])
   die("This stat cannot be trained.");
 if($_POST['amnt'] > $ir['energy'])
   print("You do not have enough energy to train that much.<hr />");
   for($i=0; $i<$_POST['amnt']; $i++)
     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 - $tim  WHERE `userid` = $userid");
     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.";
     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.";
     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.";
     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 />";
print "Choose the stat you want to train and the times you want to train it.

You can train " . (int)($ir['energy'] /= 5) . " times with the energy you have.<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']})

Times to train: <input type='text' name='amnt' value= " . (int)($ir['energy']) . " />

<input type='submit' value='Train' /></form>";


Would love a Free Fix :D But if not Im willing to pay in about 2 days - but would need the fix A.S.A.P. So I can release my game and start getting donations to pay :)

Link to comment
Share on other sites

Re: Gym Problem -- 100 Max Energy!

*BUMP* Managed to get it nearly fixed - Its just displaying the wrong amounts in "You can train up to ** more..." and "Times to train: **" after I click to train and use all my energy - but it does use all of my energy and trains correctly - its just after i train.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...