hrabik1 Posted October 6, 2007 Share Posted October 6, 2007 Heres a gym for people who dont have any crystals. <?php /* money gym mod hrabik1 www.criminalspreev2.com */ 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'])) { $tgain=0; for($i=1;$i<=$_GET['times'] && $ir['money'] > 0;$i++) { if ($ir['money'] > 0) { $gain=rand(1,3)/rand(100,300)*rand(100,300)*(($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,money=money-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 money=money-1,exp=exp+$egain,will=will-$wu WHERE userid=$userid",$c); } else { $ir['will']=0; mysql_query("UPDATE users SET money=money-1,exp=exp+$egain,will=0 WHERE userid=$userid",$c); } $ir['money']-=1; $ir['exp']+=$egain; } else { $out="You do not have enough money 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['money']} money left. "; } else { $out=" Money Gym: Main Lobby "; } $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['money']} times. Strength Speed Work Skill Defence "; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 9, 2007 Share Posted October 9, 2007 Re: Money Gym this will be good when v2 Quote Link to comment Share on other sites More sharing options...
gear4life Posted October 9, 2007 Share Posted October 9, 2007 Re: Money Gym is this v2 Posts: 2 View Profile Email Personal Message (Offline) Ignore Money Gym « on: October 05, 2007, 08:24:09 PM » Reply with quoteQuote Heres a gym for people who dont have any crystals. <?php /* money gym mod */ session_start(); include "globals.php"; 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'])) { $tgain=0; for($i=1;$i<=$_GET['times'] && $ir['money'] > 0;$i++) { if ($ir['money'] > 0) { $gain=rand(1,3)/rand(100,300)*rand(100,300)*(($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,money=money-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 money=money-1,exp=exp+$egain,will=will-$wu WHERE userid=$userid",$c); } else { $ir['will']=0; mysql_query("UPDATE users SET money=money-1,exp=exp+$egain,will=0 WHERE userid=$userid",$c); } $ir['money']-=1; $ir['exp']+=$egain; } else { $out="You do not have enough money 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['money']} money left. "; } else { $out="<h3>Money 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['money']} times. <form action='mgym.php' method='get'> <input type='text' name='times' value='1' /><select type='dropdown' name='train'> <option value='strength'>Strength</option> <option value='agility'>Speed</option> <option value='labour'>Work Skill</option> <option value='guard'>Defence</option></select> <input type='submit' value='Train!' /></form>"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted October 9, 2007 Share Posted October 9, 2007 Re: Money Gym no Quote Link to comment Share on other sites More sharing options...
gear4life Posted October 9, 2007 Share Posted October 9, 2007 Re: Money Gym i gt this error Fatal error: Cannot redeclare money_formatter() (previously declared in /home/badboyz/public_html/global_func.php:2) in /home/badboyz/public_html/global_func.php on line 5 Quote Link to comment Share on other sites More sharing options...
Godhand Posted October 9, 2007 Share Posted October 9, 2007 Re: Money Gym wouldn't just changing You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. to You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. work in this case? The reason I'm asking is because that is the same thought how the market glitch was removed. Quote Link to comment Share on other sites More sharing options...
hitman Posted October 9, 2007 Share Posted October 9, 2007 Re: Money Gym file name moneygym.php if nt mgym.php <?php /* money gym mod */ include "globals.php"; $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'])) { $tgain=0; for($i=1;$i<=$_GET['times'] && $ir['money'] > 0;$i++) { if ($ir['money'] > 0) { $gain=rand(1,3)/rand(100,300)*rand(100,300)*(($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,money=money-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 money=money-1,exp=exp+$egain,will=will-$wu WHERE userid=$userid",$c); } else { $ir['will']=0; mysql_query("UPDATE users SET money=money-1,exp=exp+$egain,will=0 WHERE userid=$userid",$c); } $ir['money']-=1; $ir['exp']+=$egain; } else { $out="You do not have enough money 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['money']} money left. "; } else { $out="<h3>Money 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['money']} times. <form action='mgym.php' method='get'> <input type='text' name='times' value='1' /><select type='dropdown' name='train'> <option value='strength'>Strength</option> <option value='agility'>Speed</option> <option value='labour'>Work Skill</option> <option value='guard'>Defence</option></select> <input type='submit' value='Train!' /></form>"; $h->endpage(); ?> if its rong let me know Quote Link to comment Share on other sites More sharing options...
Godhand Posted October 9, 2007 Share Posted October 9, 2007 Re: Money Gym erm... I'd rather not add a money gym to my game I was just looking over. Also looks like it has another glitch though that I noticed (wouldn't output an error message) It will subtract 1 money not the number of times trained. Also note- if someone trains too much (say maybe 500 for good players) that could cause some major lag in your server. You might want to do the money/50 or something (scale) to keep it 'limited' and make the money update money-timestrained*scale (obviously its not in code so don't think its the exact function). I'm just using constructive criticism to help make it better. I'm not trying to be a jerk about it sorry if I am sounding like one. Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 10, 2007 Share Posted October 10, 2007 Re: Money Gym Warning: Missing argument 4 for headers::userdata(), called in /home/eyers/public_html/mgym.php on line 58 and defined in /home/eyers/public_html/header.php on line 136 also repeats menu twice Quote Link to comment Share on other sites More sharing options...
Godhand Posted October 10, 2007 Share Posted October 10, 2007 Re: Money Gym Well you have a problem in your header.php then on line 136. Open up notepad and do edit- go to-plug in line 136 And the error within mgym.php is You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. unless you customized it. To fix it just compare with other codes and see what the difference is. I'm just pointing to a general direction. Quote Link to comment Share on other sites More sharing options...
Klikoka Posted November 4, 2007 Share Posted November 4, 2007 Re: Money Gym this is just a crystal gym re-written isnt it :? Quote Link to comment Share on other sites More sharing options...
Godhand Posted November 4, 2007 Share Posted November 4, 2007 Re: Money Gym Heres a gym for people who dont have any crystals. I believe that just from that it should be enough said. 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.