Jump to content

Gym Help


Recommended Posts

Hello everyone just asking for a bit of help with mc lite gym.

my current energy starts at 100 and i tried to change the gym so it takes 10 energy instead of 1

and i changed this line


but when i go train and i do it 10 times my energy goes into minus 2 then goes back up to 90 etc.. i dont know if i have changed the wrong bit or not

can anyone help me out please?

Link to comment
Share on other sites

Re: Gym Help

There you go thanks for taking time to look radio


MCCodes Lite
gym.php Rev 1.0.0
Copyright (C) 2006 Dabomstew

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
require "header.php";
$h = new headers;
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$lv=date('F j, Y, g:i a',$ir['laston']);
$_GET['times']= abs((int) $_GET['times']);
if($_GET['train'] != "strength" && $_GET['train'] != "agility" && $_GET['train'] != "guard" && $_GET['train'] != "labour") { $h->userdata($ir,$lv,$fm,$cm);
$h->menuarea(); die("Abusers aren't allowed."); } 
for($i=1;$i<=$_GET['times'] && $ir['energy'] > 0;$i++)
if ($ir['energy'] > 0)
if ($_GET['train']=="IQ") { $gain/=100; }

mysql_query("UPDATE userstats SET $st=$st+".$gain." WHERE userid=$userid",$c) or die("UPDATE userstats SET $st=$st+$gain,energy=energy-1,exp=exp+$egain WHERE userid=$userid
$wu=(int) (rand(1,3));
if ($ir['will'] >= $wu)
mysql_query("UPDATE users SET energy=energy-1,exp=exp+$egain,will=will-$wu WHERE userid=$userid",$c);
mysql_query("UPDATE users SET energy=energy-1,exp=exp+$egain,will=0 WHERE userid=$userid",$c);

$out="You do not have enough energy to train.";
$out="You begin training your $st.

You have gained $tgain $st by training it $i times.

You now have $stat $st and {$ir['energy']} energy left.


$out="<h3>Gym: Main Lobby<h3>";
print $out;
print "Enter the amount of times you wish to train and choose the stat to train.

You can train up to {$ir['energy']} times.
<form action='gym.php' method='get'>
<input type='text' name='times' value='1' /><select type='dropdown' name='train'>
<option value='strength'>Strength</option>
<option value='agility'>Agility</option>
<option value='labour'>Labour</option>
<option value='guard'>Guard</option></select>

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

Link to comment
Share on other sites

Re: Gym Help

You changed the leveling formula as well then? I know I've made a sort of custom gym before. The easiest way to limit it to get 10 trains is to require it to be the post count *10 and detect if post count*10>energy. Just update your query after that to match it all.

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