Jump to content
MakeWebGames

[mccode] Money Gym


hrabik1

Recommended Posts

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();

?>

Link to comment
Share on other sites

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();

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 weeks later...

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