Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('header.php');
- function error($msg) {
- echo Message($msg);
- include(__DIR__ . '/footer.php');
- exit;
- }
- if($user_class->energy < 10)
- error("Sorry, it costs 10 energy to Arson a Home. You only have {$user_class->energy} energy. Come back later.");
- if($user_class->jail or $user_class->hospital > 0)
- error("You can't train at the gym if you are in ".($user_class->jail ? 'jail' : 'hospital').".");
- switch($_GET['action'])
- {
- case 'search': search(); break;
- case 'searchsub': search_sub(); break;
- case 'pourpetrol': pour_petrol(); break;
- case 'burn': burn(); break;
- default: index(); break;
- }
- function index()
- {
- global $user_class;
- $burnperson = new User($_GET['id']);
- $res = mysql_query("SELECT `id`,`username` FROM `grpgusers` WHERE `username` = '".$burnperson->id."'");
- $r = mysql_fetch_array($res);
- $cost = ($user_class->level * 2000);
- if(!$user_class->id) {
- error("Invalid User");
- }
- else
- {
- print "<tr><td class='contenthead'>Burn House</td></tr>
- <tr><td class='contentcontent'>
- Would you like to burn down ".$burnperson->formattedname."'s home for \$$t".prettynum($cost,'')."? <br /> <br />
- <form action = 'burnhouse.php?action=pourpetrol&ID=<? echo $burnperson->id; ?>' method = 'post' />
- <input type = 'submit' STYLE='color: black; background-color: red;' value = 'YES' /> </form> <br>
- <form action = 'index.php' method = 'post' />
- <input type = 'submit' STYLE='color: black; background-color: green;' value = 'NO WAY' /> </form>
- </td></tr>";
- }
- }
- function pour_petrol()
- {
- global $user_class;
- $burnperson = new User($_GET['id']);
- $r = mysql_fetch_array(mysql_query("SELECT `id`,`username` FROM `grpgusers` WHERE `id` = '".$burnperson->id."'"));
- $cost = ($user_class->level * 2000);
- $userid = $user_class->id;
- if($burnperson->id == $userid)
- error("Only the Crazy Burn their own homes down.");
- if(!$user_class->id)
- error("Invalid user");
- if($user_class->money < $cost)
- error("You don't have enough money. <a href = 'bank.php' />Go Here</a> to get some more.");
- if($r['petrol'] == 0) {
- die("You can't burn down ".$burnperson->formattedname."'s house when you don't have any petrol. Search for some <a href = 'burnhouse.php?action=search' />HERE</a>.");
- }
- else
- {
- print "
- <tr><td class='contenthead'>Burn House</td></tr>
- <tr><td class='contentcontent'>
- You pour petrol all over {$r['username']}'s furniture and walls. After emptying a three-gallon carton of petrol, you pull out your matchbox. Do you pull out a match and light it? <br /> <br />
- <form action = 'burnhouse.php?action=burn&ID={$_GET['ID']}' method = 'post' />
- <input type = 'submit' STYLE='color: black; background-color: white;' value = 'Light Match' /> </form> <br>
- <form action = 'index.php' method = 'post' />
- <input type = 'submit' STYLE='color: black; background-color: white;' value = 'No, Go Home' /> </form>
- </td></tr>";
- }
- }
- function burn()
- {
- global $user_class;
- $userid = $user_class->id;
- if($_GET['ID'] == $userid)
- error("Only the Crazy Burn their own homes down.");
- $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs(intval($_GET['ID'])) : null;
- $r=mysql_fetch_array(mysql_query("SELECT `id`,`username`,`petrol`,`matches`,`crimesucceeded` FROM `grpgusers` WHERE `id` = '".$user_class->id."'"));
- if(!$r['id'])
- error("Invalid User");
- if($r['petrol'] == 0)
- {
- error("You don't have any petrol to burn down the house. Go <a href = 'burnhouse.php?action=search' />HERE</a> to find some more.");
- }
- elseif($r['matches'] == 0)
- {
- error("You open the box of matches and see there's none inside. You'll have to get some more. Go <a href = 'burnhouse.php?action=search' />HERE</a> to get some more.");
- }
- else
- {
- $mult = $user_class->level * $user_class->level;
- $chance = min(($r['crimesucceeded']/$mult) * 50+1, 95);
- $harm = rand(1,200);
- $cost = ($user_class->level * 200);
- if(rand(1,210) < $chance AND $harm < 190)
- {
- $gain=$user_class->level*5;
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>You light the match, drop it and run outside. You successfully burned {$r['username']} 's Home Down.<br /> <br />
- > <a href='index.php'>Run Home</a></td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `petrol` = `petrol` - '%d',
- `matches` = `matches` - '%d',
- `money` = `money` - '%d'
- WHERE `id` = ('%u')",
- $gain, 1, 1, $cost, $userid));
- mysql_query(sprintf("UPDATE `grpgusers` SET `awake` = 0
- WHERE `id` = {$r['id']}"));
- mysql_query(sprintf("UPDATE `grpgusers` SET `jail` = 0
- WHERE `id` = {$r['id']}"));
- Send_Event($r['id'], "<a href='profiles.php?u={$r['id']}'>{$r['username']}</a> Burned your House down. You lost all of your will and was let out of Jail if you were in jail. Click <a href='burnhouse.php?action=pourpetrol&ID={$userid}'>here</a> to Arson their Home.");
- }
- elseif(rand(1,210) < $chance AND $harm > 190)
- {
- $gain=$r['level']*5;
- $hosp = rand(300,500);
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>You light the match and drop it, not noticing you have petrol on your shoes and jeans. As the match hits the floor, the room goes aflame but so do you. You successfully burned {$r['username']} 's Home Down but go into hospital for $hosp minutes with severe burns. <br /> <br />
- > <a href='index.php'>Go to Hospital</a></td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `hospital` = '%d',
- `petrol` = `petrol` - '%d',
- `matches` = `matches` - '%d',
- `money` = `money` - '%d'
- WHERE `id` = ('%u')",
- $gain, $hosp, 1, 1, $cost, $userid));
- mysql_query(sprintf("UPDATE `grpgusers` SET `awake` = 0
- WHERE `id` = {$r['id']}"));
- mysql_query(sprintf("UPDATE `grpgusers` SET `jail` = 0
- WHERE `id` = {$r['id']}"));
- Send_Event($r['id'], "<a href='viewuser.php?u={$r['id']}'>{$r['username']}</a> Burned your House down. You lost all of your will and was let out of Jail if you were in jail. They also went into hospital for setting themselves alight. Click <a href='burnhouse.php?action=pourpetrol&ID={$userid}'>here</a> to Arson their Home.");
- }
- elseif(rand(1,210) > $chance AND $harm < 190)
- {
- $jailtime = min($mult, 100);
- $hospital = min(rand(60,200), 75);
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>You light the match and drop it. You run outside and bump straight into a police officer, who wrestles you to the floor. After cuffing you, he calls the fire department who arrive in 5 minutes. They put the fire out before too much damage is caused. You go to jail for $jailtime minutes and {$r['username']} goes to hospital for $hospital minutes with a few burns. <br /> <br />
- > <a href = 'jail.php' />Go to Jail</a></td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `jail` = '%d',
- `money` = `money` - '%d',
- `matches` = `matches` - '%d',
- `petrol` = `petrol` - '%d'
- WHERE `id` = ('%u')",
- $jailtime, $cost, 1, 1, $userid));
- mysql_query(sprintf("UPDATE `grpgusers` SET `hospital` = `hospital` + '%d',
- WHERE `id` = {$r['userid']}",
- $hospital));
- Send_Event($r['id'], "<a href = 'viewuser.php?u={$r['id']}' />{$r['username']}</a> ran into a cop after attempting to arson your house. He went to jail but you also went into hospital with some burns.");
- }
- elseif(rand(1,210) > $chance AND $harm > 190)
- {
- $jailtime = min($mult, 100);
- $hospital = min(rand(60,200), 75);
- $cost = ($user_class->level * 200);
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>You light the match and drop it on the floor. As you run for the door, you trip on the carpet and fall face first into a bookshell. You're engulfed by the flames. As you scream for help, you hear sirens in the distance. 10 minutes later, you're pulled from the house with burns all over your body. You're taken to the hospital. When there, your ward is surrounded by cops, ready to take you to jail when you get better. However, you successfully burned down {$r['username']}'s house!<br /> <br />
- > <a href = 'jail.php' />Go to Jail</a> > <a href = 'hospital.php' />Go to Hospital</a></td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `jail` = '%d',
- `hospital` = '%d',
- `money` = `money` - '%d',
- `matches` = `matches` - '%d',
- `petrol` = `petrol` - '%d'
- WHERE `id` = ('%u')",
- $jailtime, $hospital, $cost, 1, 1, $userid));
- mysql_query(sprintf("UPDATE `grpgusers` SET `jail` = '%d',
- `awake` = '%d'
- WHERE `id` = {$r['userid']}",
- 0, 0));
- }
- elseif(rand(1,210) > $chance)
- {
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>While trying Arson the House you were seen buy a Cop. Before you could light the match, the cops bursts into the house and tackles you to the floor. He arrests you and takes you to jail. Unlucky!!<br /> <br />
- > <a href='jail.php'>Go to Jail</a></td></tr>";
- $time=min($mult, 100);
- mysql_query(sprintf("UPDATE `grpgusers` SET `jail` = '%d',
- `petrol` = `petrol` - '%d',
- `money` = `money` - '%d'
- WHERE `id` = ('%u')",
- $time, 1, $cost, $userid));
- Send_Event($r['id'], "<a href='viewuser.php?u={$r['id']}'>{$r['username']}</a> was caught trying to Burn your house down.");
- }
- else
- {
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>You chicken out before you light the match. You quickly run out of the house and run home. You lose a gallon of petrol. <br /> <br />
- > <a href = 'index.php' />Go Home</a></td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `petrol` = `petrol` - '%d'
- WHERE `id` = ('%d')",
- 1, $userid));
- }
- }
- }
- function search()
- {
- global $user_class;
- $res = mysql_query("SELECT `warehouse` FROM `grpgusers` WHERE `id` = '".$user_class->id."'");
- $row = mysql_fetch_array($res);
- if($row['warehouse'] >= 5)
- {
- error("You've already searched here 5 times and are too tired to search again. Come back tomorrow. <a href = 'index.php' />Go Home</a>");
- }
- else
- {
- print "<tr><td class='contenthead'>Search for Petrol/Matches</td></tr>
- <tr><td class='contentcontent'>
- You head over to an abandoned warehouse and have a look at it. Do you want to break in and search for petrol and matches? <br /> <br />
- <form action = 'burnhouse.php?action=searchsub' method = 'post' />
- <input type = 'submit' STYLE='color: black; background-color: white;' value = 'Break In' /> </form> <br>
- <form action = 'index.php' method = 'post' />
- <input type = 'submit' STYLE='color: black; background-color: white;' value = 'Go Home' /> </form></td></tr>";
- }
- }
- function search_sub()
- {
- global $user_class;
- $userid = $user_class->id;
- $search = rand(1,4);
- $cash = rand(200,800);
- $matches = rand(2,6);
- $petrol = rand(1,4);
- $jtime = rand(300,600); /* time is so high because the jail is inserting using timestamps ( 300 = 5 minutes ) */
- $pet = rand(6,8);
- $mat = rand(6,10);
- $big = rand(800,1000);
- $res = mysql_query("SELECT `warehouse` FROM `grpgusers` WHERE `id` = '".$user_class->id."'");
- $row = mysql_fetch_array($res);
- if($row['warehouse'] >= 5)
- {
- error("You've already searched here 5 times and are too tired to search again. Come back tomorrow. <a href = 'index.php' />Go Home</a>");
- }
- else
- {
- if($search == 1)
- {
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>While searching the abandoned warehouse, you find $matches matches and $petrol gallons of petrol. Good job! <a href = 'index.php' />Go Home</a>.</td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `matches` = `matches` + '%d',
- `petrol` = `petrol` + '%d',
- `warehouse` = `warehouse` + '%d'
- WHERE `id` = ('%u')",
- $matches, $petrol, 1, $userid));
- }
- elseif($search == 2)
- {
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>While searching through the abandoned warehouse, you find nothing but \$$cash. Disappointed, you head <a href = 'index.php' />home</a>.</td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `money` = `money` + '%d',
- `warehouse` = `warehouse` + '%d'
- WHERE `id` = ('%u')",
- $cash, 1, $userid));
- }
- elseif($search == 3)
- {
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>While searching through the abandoned warehouse, you knock over a stack of shelves which fall on top of you. You start screaming for help and 10 minutes later the cops arrive. They take you away to the jail for $jtime for breaking and entering. <br /> <br />
- <a href = 'jail.php' />Go to Jail</a></td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `jail` = '%d',
- `warehouse` = `warehouse` + '%d'
- WHERE `id` = ('%u')",
- $jtime, 1, $userid));
- }
- elseif($search == 4)
- {
- print "<tr><td class='contenthead'></td></tr>
- <tr><td class='contentcontent'>While searching through the abondoned warehouse, you get lucky and find a large stash of petrol, matches and money. Feeling selfish, you take the lot: $pet gallons of petrol, $mat matches and \$$big. <a href = 'index.php' />Head home</a>.</td></tr>";
- mysql_query(sprintf("UPDATE `grpgusers` SET `money` = `money` + '%d',
- `matches` = `matches` + '%d',
- `petrol` = `petrol` + '%d',
- `warehouse` = `warehouse` + '%d'
- WHERE `id` = ('%u')",
- $big, $mat, $pet, 1, $userid));
- }
- }
- }
- include('footer.php');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment