Jump to content
MakeWebGames

Recommended Posts

Posted

Hey sorry for my english on my game crystalbank.php mod v2 doest give me 2% intrest the file is

<?php

include "globals.php";

print "<h3>Crystal Reserve</h3>";

if($ir['cbank']>-1)

{

switch($_GET['action'])

{

case "deposit":

deposit();

break;

case "withdraw":

withdraw();

break;

default:

index();

break;

}

}

else

{

if(isset($_GET['buy']))

{

if($ir['money']>4999999)

{

print "Congratulations, you bought a crystal reserve account for \$5,000,000!

Start using my account";

$db->query("UPDATE users SET money=money-5000000,cbank=0 WHERE userid=$userid");

}

else

{

print "You do not have enough money to open an account.

Back to town...";

}

}

else

{

print "Open a crystal reserve account today, just \$5,000,000!

> Yes, sign me up!";

}

}

function index()

{

global $db, $ir,$c,$userid,$h;

print "\nYou currently have {$ir['cbank']} in the crystal reserve.

At the end of each day, your crystal reserve balance will go up by 2%.

<table width='75%' cellspacing=1 class='table'> <tr> <td width='50%'>Deposit Crystals

It will cost you 15% of the crystals you deposit, rounded up. The maximum fee is \$3,000.<form action='cbank.php?action=deposit' method='post'>

Amount: <input type='text' name='deposit' value='{$ir['crystals']}' />

<input type='submit' value='Deposit' /></form></td> <td>

Withdraw Crystals

There is no fee on withdrawals.<form action='cbank.php?action=withdraw' method='post'>

Amount: <input type='text' name='withdraw' value='{$ir['cbank']}' />

<input type='submit' value='Withdraw' /></form></td> </tr> </table>";

}

function deposit()

{

global $db,$ir,$c,$userid,$h;

$_POST['deposit']=abs((int) $_POST['deposit']);

if($_POST['deposit'] > $ir['crystals'])

{

print "You do not have enough crystals to deposit this amount.";

}

else

{

$fee=ceil($_POST['deposit']*15/100);

if($fee > 3000) { $fee=3000; }

$gain=$_POST['deposit']-$fee;

$ir['cbank']+=$gain;

$db->query("UPDATE users SET cbank=cbank+$gain, crystals=crystals-{$_POST['deposit']} where userid=$userid");

print "You hand over {$_POST['deposit']} to be deposited,

after the fee is taken ($fee), $gain crystals is added to your crystal reserve account.

You now have {$ir['cbank']} in the crystal reserve.

> Back";

}

}

function withdraw()

{

global $db,$ir,$c,$userid,$h;

$_POST['withdraw']=abs((int) $_POST['withdraw']);

if($_POST['withdraw'] > $ir['cbank'])

{

print "You do not have enough reserved crystals to withdraw this amount.";

}

else

{

$gain=$_POST['withdraw'];

$ir['cbank']-=$gain;

$db->query("UPDATE users SET cbank=cbank-$gain, crystals=crystals+$gain where userid=$userid");

print "You ask to withdraw $gain,

the crystal reserve automated teller spits out your crystals into a little satchel.

A robotic arm then picks up the satchel and drops it into your hand.

You there hear a robotic voice chime

- Have a nice day {$ir['username']} -

You now have {$ir['cbank']} crystals in the crystal reserve.

> Back";

}

}

$h->endpage();

?>

Please fix it and put it here thnx

Posted

Re: Crystal bank intrest

 

you need this cron in cron_day.php

 

$db->query("UPDATE users SET cbank=cbank+(bankmoney/50) where cbank>0");

 

LOL isnt it:

$db->query("UPDATE users SET cbank=cbank+(cbank/50) where cbank>0");

Posted

Re: Crystal bank intrest

Ang on...

That is good but this is better

OLD

$db->query("UPDATE users SET cbank=cbank+(cbank/50) where cbank>0");

 

NEW

$db->query("UPDATE users SET cbank=cbank+(cbank/50) where cbank>0 AND daysinactive > 7");

 

Keeps the games economy low aswell. ;)

Posted

Re: Crystal bank intrest

 

$db->query("UPDATE users SET cbank=cbank+(cbank/50) where cbank>0 AND daysinactive > 7");

That won't work unless he installs the mod that adds daysinactive to the user table.

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