I decided that I want to become a good coder when it comes to modding mccodes.
So I am no longer selling the stealing mod instead you all can have it for free!
To get this all you have to do is tell me how I did!
Also the crystal bank was not made by me so I do not know if it is debugged, I found it in the old free modifications forum.
steal.php:
<?php
include "globals.php";
$ITEMSELECT = $db->query("SELECT `inv_itemid` FROM `inventory` WHERE `inv_userid`={$_GET['ID']} ORDER BY RAND() LIMIT 1");
$row=$db->fetch_row($ITEMSELECT);
$user = $db->query("SELECT * FROM `inventory` WHERE `inv_userid`=$userid");
$item = $row['inv_itemid'];
$get_user_stats = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE userid={$_GET['ID']}"));
$playerlevel = $get_user_stats['level'];
$ran = (rand(0,10));
$_GET['ID'] = abs((int) $_GET['ID']);
$_POST['money'] = abs((int) $_POST['money']);
if(!((int)$_GET['ID']))
{
print "Invalid User ID";
}
else if($_GET['ID'] == $userid)
{
print "Haha, what does stealing money from yourself do anyway?";
}
else
$mu=$db->query("SELECT userid FROM users WHERE userid=$userid AND steal_timestamp > unix_timestamp()-(60*30)");
$mug=$db->num_rows($mu);
if($mug){
die("
Sorry, you stole from someone in the past 30 Minutes. <meta http-equiv='refresh' content='2; url=index.php'>");
}else
if($ir['level'] >= ($playerlevel+20)){
die("
You cannot rob someone who is 20 levels or more then you. <meta http-equiv='refresh' content='2; url=index.php'>");
}
else
{
if($playerlevel >=($ir['level']+20)){
die("
You cannot rob someone who is 20 or more levels higher then you. <meta http-equiv='refresh' content='2; url=index.php'>");
}
else
if($ran > 4){
$db->query("UPDATE users SET steal_timestamp = unix_timestamp() WHERE userid=$userid");
die("
You stole nothing. <meta http-equiv='refresh' content='2; url=index.php'>");
}
else
if(!empty($item)){
if($ran == 0){
if($row['inv_qty'] > 1){
if($row['inv_itemid'] == $user['inv_itemid'] && $row['inv_qty'] >= $user['inv_qty']){
$db->query("UPDATE `inventory` SET inv_qty=inv_qty+'1' WHERE inv_itemid=$item AND inv_userid=$userid");
$db->query("UPDATE `inventory` SET inv_qty=inv_qty-'1' WHERE inv_itemid=$item AND inv_userid={$_GET['ID']}");
}
else
$db->query("UPDATE `inventory` SET inv_qty=inv_qty-'1' WHERE inv_itemid=$item AND inv_userid={$_GET['ID']}");
$queryreg = mysql_query("
INSERT INTO `inventory` VALUES ('','$item','$userid','1')
");
}
else
$db->query("UPDATE `inventory` SET inv_userid=$userid WHERE inv_itemid=$item");
$db->query("UPDATE `inventory` SET inv_userid=$userid WHERE inv_itemid=$item AND userid={$_GET['ID']}");
$db->query("UPDATE users SET steal_timestamp = unix_timestamp() WHERE userid=$userid");
print "
You stole 1 item from [b]{$get_user_stats['username']}[/b]. Go check it out in your inventory! <meta http-equiv='refresh' content='2; url=index.php'>";
event_add($_GET['ID'],"{$ir['username']} stole an item from you.",$c);
}
}
else
if($get_user_stats['crystals'] > 0){
if($ran == 1){
$db->query("UPDATE users SET crystals=crystals+'1' WHERE userid=$userid");
$db->query("UPDATE users SET crystals=crystals-'1' WHERE userid={$_GET['ID']}");
$db->query("UPDATE users SET steal_timestamp = unix_timestamp() WHERE userid=$userid");
print "
You stole 1 crystal from [b]{$get_user_stats['username']}[/b]. <meta http-equiv='refresh' content='2; url=index.php'>";
event_add($_GET['ID'],"{$ir['username']} stole 1 crystal from you.",$c);
}
}
else
if(strlen($get_user_stats['money']) < 3){
$amount = '0';
}
else
if(strlen($get_user_stats['money']) == 3){
$random = (rand(3,12));
$money = substr(($get_user_stats['money']), 0, 1);
$amount = $random_number * $money;
}
else
if(strlen($get_user_stats['money']) == 4){
$random = (rand(3,12));
$money = substr(($get_user_stats['money']), 0, 2);
$amount = $random * $money;
}
else
if(strlen($get_user_stats['money']) == 5){
$random = (rand(3,12));
$money = substr(($get_user_stats['money']), 0, 3);
$amount = $random * $money;
}
else
if(strlen($get_user_stats['money']) == 6){
$random = (rand(3,12));
$money = substr(($get_user_stats['money']), 0, 4);
$amount = $random * $money;
}
else
if(strlen($get_user_stats['money']) == 7){
$random = (rand(3,12));
$money = substr(($get_user_stats['money']), 0, 5);
$amount = $random * $money;
}
else
if(strlen($get_user_stats['money']) == 8){
$random = (rand(3,12));
$money = substr(($get_user_stats['money']), 0, 6);
$amount = $random * $money;
}
else
if(strlen($get_user_stats['money']) == 9){
$random = (rand(3,12));
$money = substr(($get_user_stats['money']), 0, 7);
$amount = $random * $money;
}
if($amount == 0){
die("Player has very little money, it would be pointless to steal very little. <meta http-equiv='refresh' content='2; url=index.php'>");
}
else
if($get_user_stats['money'] < $amount){
die("Player does not have any money at this time. <meta http-equiv='refresh' content='2; url=index.php'>");
}
else
$db->query("UPDATE users SET money=money+$amount WHERE userid=$userid");
$db->query("UPDATE users SET money=money-$amount WHERE userid={$_GET['ID']}");
$db->query("UPDATE users SET steal_timestamp = unix_timestamp() WHERE userid=$userid");
print "
You stole \${$amount} from [b]{$get_user_stats['username']}[/b]. <meta http-equiv='refresh' content='2; url=index.php'>";
event_add($_GET['ID'],"{$ir['username']} stole \${$amount} from you.",$c);
print "</table>";
}
$h->endpage();
?>
Run these sql:
[mysql]ALTER TABLE `users` ADD `steal_timestamp` INT( 11 ) NOT NULL DEFAULT 'No Message';
[/mysql]
crystalsbank.php:
<?php
include "globals.php";
print "<h3>crystal Bank</h3>";
if($ir['crystalsbank']>-1)
{
switch($_GET['action'])
{
case "deposit": deposit(); break;
case "withdraw": withdraw(); break;
default: index(); break;
}
} else {
if(isset($_GET['buy']))
{
if($ir['money'] == 25000)
{
print "Congratulations, you bought a crystals bank account for \$25,000!
[url='crystalsbank.php']Start using my account[/url]";
$db->query("UPDATE users SET money=money-25000,crystalsbank=0 WHERE userid=$userid");
} else {
print "You do not have enough Money to open an account.
[url='explore.php']Back to town...[/url]";
}
} else {
print "Open a crystals bank account today, just \$25,000!
[url='crystalsbank.php?buy']> Yes, sign me up![/url]";
}
}
function index()
{
global $db, $ir,$c,$userid,$h;
print "[b]You currently have {$ir['crystalsbank']} crystals in the bank.[/b]
<table width='75%' cellspacing=1 class='table'> <tr> <td width='50%'>[b]Deposit crystals[/b]
<form action='crystalsbank.php?action=deposit' method='post'>
Amount: <input type='text' name='deposit' value='{$ir['crystalsbank']}' />
<input type='submit' value='Deposit' /></form></td> <td>
[b]Withdraw crystals[/b]
There is no fee on withdrawals.<form action='crystalsbank.php?action=withdraw' method='post'>
Amount: <input type='text' name='withdraw' value='{$ir['crystalsbank']}' />
<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 deposite in the bank bank.";
} else {
$gain=$_POST['deposit']-$fee;
$ir['crystals']+=$gain;
$db->query("UPDATE users SET crystalsbank=crystalsbank+$gain, crystals=crystals-{$_POST['deposit']} where userid=$userid");
print "You hand over {$_POST['deposit']} to be deposited,
$gain is added to your account.
[b]You now have {$ir['crystalsbank']} in the bank.[/b]
[url='crystalsbank.php']> Back[/url]";
}
}
function withdraw()
{
global $db,$ir,$c,$userid,$h;
$_POST['withdraw']=abs((int) $_POST['withdraw']);
if($_POST['withdraw'] > $ir['crystalsbank'])
{
print "You do not have enough crystals to withdraw from the bank.";
} else {
$gain=$_POST['withdraw'];
$ir['crystalsbank']-=$gain;
$db->query("UPDATE users SET crystalsbank=crystalsbank-$gain, crystals=crystals+$gain where userid=$userid");
print "You ask to withdraw $gain,
the banking lady grudgingly hands it over.
[b]You now have {$ir['crystalsbank']} in the bank.[/b]
[url='crystalsbank.php']> Back[/url]";
}
}
$h->endpage();
?>
Run this sql:
[mysql]
ALTER TABLE `users` ADD `crystalbank` INT( 11 ) NOT NULL DEFAULT '-1';
[/mysql]
I do not know if the crystal bank works as I stated above I found it in the old posts.
I hope you like it and if you find any bugs NOT sloppy code but bugs please let me know.
I did edit something and did not test it so there might be a bug but I doubt it....Thanks!