Jump to content
MakeWebGames

New Gym Mod STRENGTH Fail


benlucraft

Recommended Posts

Hi fellow coders, got a little issue with a Gym mod for V2 everything works ok except when i attempt to train my strength i get this error when i turn debug on

Line executed: /home/colleg30/public_html/gym.php:22

This stat cannot be trained.

Below is lines 20-30

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 />");

What is my issue? everything else is ok?

Link to comment
Share on other sites

if (isset($_POST['stat']) && $_POST['amnt'])
{
   if (!isset($statnames[$_POST['stat']]))
   {
       die("This stat cannot be trained.");
   }
   $stat = $statnames[$_POST['stat']];
   if ($_POST['amnt'] > $ir['energy'])
   {
       print("You do not have enough energy to train that much.<hr />");
   }

 

Should work for you. Just make sure when you add this to your gym file you take out the { } not needed, the code you posted does not have the closing } in it.

  • Like 1
Link to comment
Share on other sites

if (isset($_POST['stat']) && $_POST['amnt'])
{
if (!isset($statnames[$_POST['stat']]))
{
die("This stat cannot be trained.");
}
$stat = $statnames[$_POST['stat']];
if ($_POST['amnt'] > $ir['energy'])
{
print("You do not have enough energy to train that much.<hr />");
}

 

Should work for you. Just make sure when you add this to your gym file you take out the { } not needed, the code you posted does not have the closing } in it.

 

Ill give it a shot thanks Mcfarlin! +1

Link to comment
Share on other sites

You might need to add your stat array here so we can look at that aswell

$statnames=array(

'Strength' => 'strength',

'Agility' => 'agility',

'Labour ' => 'labour',

'Guard' => 'guard');

I got the strength training to work but now it will not let me train my Labour it just says cannot train stat...

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.

Guest
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...