Sethenor Posted January 4, 2009 Share Posted January 4, 2009 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 $ir['energy']-=10 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? Quote Link to comment Share on other sites More sharing options...
gurpreet Posted January 4, 2009 Share Posted January 4, 2009 Re: Gym Help Don't think you can...Don't want to mess with the $_POST['amnt']; unless you know what you want to do, or like you've seen, it will mess up your gym. Quote Link to comment Share on other sites More sharing options...
Sethenor Posted January 4, 2009 Author Share Posted January 4, 2009 Re: Gym Help I have seen it done on a few sites but i just dont know how to do it :| Quote Link to comment Share on other sites More sharing options...
Sethenor Posted January 4, 2009 Author Share Posted January 4, 2009 Re: Gym Help Can no one tell me how to do it :( Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 4, 2009 Share Posted January 4, 2009 Re: Gym Help Can you post the whole gym file... Not so familiar with lite. Quote Link to comment Share on other sites More sharing options...
Sethenor Posted January 4, 2009 Author Share Posted January 4, 2009 Re: Gym Help There you go thanks for taking time to look radio <?php /* 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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. */ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); 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()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $out=""; $_GET['times']= abs((int) $_GET['times']); if(isset($_GET['train'])) { 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."); } $tgain=0; for($i=1;$i<=$_GET['times'] && $ir['energy'] > 0;$i++) { if ($ir['energy'] > 0) { $gain=rand(1,3)/rand(800,1000)*rand(800,1000)*(($ir['will']+20)/150); $tgain+=$gain; if ($_GET['train']=="IQ") { $gain/=100; } $ir[$_GET['train']]+=$gain; $egain=$gain/10; $ts=$ir[$_GET['train']]; $st=$_GET['train']; 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 ".mysql_error()); $wu=(int) (rand(1,3)); if ($ir['will'] >= $wu) { $ir['will']-=$wu; mysql_query("UPDATE users SET energy=energy-1,exp=exp+$egain,will=will-$wu WHERE userid=$userid",$c); } else { $ir['will']=0; mysql_query("UPDATE users SET energy=energy-1,exp=exp+$egain,will=0 WHERE userid=$userid",$c); } $ir['energy']-=1; $ir['exp']+=$egain; } else { $out="You do not have enough energy to train."; } } $stat=$ir[$st]; $i--; $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. "; } else { $out="<h3>Gym: Main Lobby<h3>"; } $h->userdata($ir,$lv,$fm); $h->menuarea(); 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>"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 4, 2009 Share Posted January 4, 2009 Re: Gym Help So you want to make it so 10 energy = 1 energy? So out of having 100 energy, you will get 10 trains out of it? Like torn city does? Quote Link to comment Share on other sites More sharing options...
Sethenor Posted January 4, 2009 Author Share Posted January 4, 2009 Re: Gym Help So you want to make it so 10 energy = 1 energy? So out of having 100 energy, you will get 10 trains out of it? Like torn city does? Yeah basicly Quote Link to comment Share on other sites More sharing options...
radio_active Posted January 4, 2009 Share Posted January 4, 2009 Re: Gym Help Can you tell me a bit more about it, such as are you using the "everyone has 100 energy" mod etc etc? Quote Link to comment Share on other sites More sharing options...
Sethenor Posted January 4, 2009 Author Share Posted January 4, 2009 Re: Gym Help Yeah everybody has 100 energy didnt know it was a mod though i just did that via register and db Quote Link to comment Share on other sites More sharing options...
Godhand Posted January 6, 2009 Share Posted January 6, 2009 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. Quote Link to comment Share on other sites More sharing options...
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.