Jump to content
MakeWebGames

War_Hero

Members
  • Posts

    232
  • Joined

  • Last visited

Everything posted by War_Hero

  1. Re: [Free V2] Lottery Oh sorry about that! I need that for my brother's game and forgot to remove it. :-o :-P
  2. War_Hero

    Red Dwarf

    Re: Red Dwarf Red Dwarf is one of the best comedies ever. Rimmer: "Step up to red alert!" Kryten: "Are you sure, sir. It does mean changing the bulb." Got to be one of the best lines in the entire series!
  3. Re: [Free V2] Lottery I thought I'd edit this a little bit to allow the user to enter the amount of tickets they'd like to buy. :) Hope you don't mind Akash. ;) :-P   <?php include "globals.php"; switch($_GET['action']) { case 'buysub': buy_sub(); break; default: index(); break; } function index() { global $db,$ir,$userid; $cost = 1000; $tick = 100; $sql = sprintf("SELECT * FROM `lottery`"); $query = $db->query($sql); $row = $db->fetch_row($query); echo sprintf(" <font color = 'yellow' size = '4' /><b /> Welcome to the Nation Jackpot. You currently have %d tickets and are able to purchase up to %d tickets per week. Each ticket costs £%d. The jackpot is £%u.", $ir['lottery'], $tick, $cost, $row['jackpot']); echo " <form action = 'lottery.php?action=buysub' method = 'post' /> <input type = 'text' name = 'buysub' value = '1' /> <input type = 'submit' value = 'Buy Tickets' /> </form>"; } function buy_sub() { global $db,$ir,$userid; $_POST['buysub'] = abs((int) $_POST['buysub']); $cost = 1000; $price = $cost * $_POST['buysub']; if($_POST['buysub'] > 100) { die("You can't buy more than 100 lottery tickets. <a href = 'index.php' />Go Home</a>"); } if($ir['lottery'] >= 100) { die("You have already purchased 100 tickets this week. <a href = 'index.php' />Go Home</a>"); } if($_POST['buysub'] + $ir['lottery'] > 100) { die("You can't buy this many tickets because you would exceed the maximum amount of allowed tickets. <a href = 'index.php' />Go Home</a>"); } if($ir['money'] < $price) { die("You don't have enough money to buy {$_POST['buysub']} tickets. <a href = 'index.php' />Go Home</a>"); } else { print "You have bought {$_POST['buysub']} lottery tickets. <a href = 'index.php' />Go Home</a>"; $sql = sprintf("UPDATE `users` SET `lottery` = `lottery` + '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $_POST['buysub'], $price, $userid); $db->query($sql); $sql1 = sprintf("INSERT INTO `lottery` (id,userid, amount) VALUES (%d,%u, %d)", '',$userid, $price); $db->query($sql1); $sql2 = sprintf("UPDATE `lottery` SET `jackpot` = `jackpot` + '%d'", $price); $db->query($sql2); } } $h->endpage(); ?>   Make sure to have run the SQLs and crons posted in the first post by Akash. :)   I'm still a newbie, so this probably could have been done a lot easier. :-P Hope you all enjoy. :)   EDIT: Removed include "travellingglobals.php"; from code. It should work now. :)
  4. Re: Fatal Error I agree with you there. I now see why some people say it's not good to learn PHP from MCCODES..... What also confused me with that particular IF/ELSE statement was where to put it because of the functions. But I managed my way round it. I might experience an issue similar to it when I edit my travel mod... (I'm doing a bit of editing to a few of my pages to incorporate a new mod I made.) :)
  5. Re: Fatal Error Oh no. I didn't code the Cyber Bank. It came with the V2 package. ;) I know how to use else/if, just got a bit confused when I was trying to add in that particular bit. I've got it to work now, just needed to tweak some of the code. :) I might just go back and neaten up the Cyber Bank code so it's much easier to read. :)
  6. Re: Fatal Error Hmm. That still doesn't work. :( I get this error: Parse error: syntax error, unexpected '}' in /usr/home/********/domains/globalconflict2250.co.uk/public_html/cyberbank.php on line 16. This was for the second code. I get this error for the first one: Parse error: syntax error, unexpected T_ELSE in /usr/home/*********/domains/globalconflict2250.co.uk/public_html/cyberbank.php on line 31 I'm having a look at it as well to see what's wrong.
  7. Re: Fatal Error Thank you for replying. But I now get this error: Parse error: syntax error, unexpected T_ELSE in /usr/home/********/domains/globalconflict2250.co.uk/public_html/cyberbank.php on line 31 :( I don't really like ELSES because I've had some trouble with them before. :-P
  8. Hi all. :) I'm getting a bit annoyed with this error I keep getting: Fatal error: Call to undefined function index() in /usr/home/**********/domains/globalconflict2250.co.uk/public_html/cyberbank.php on line 28 This is my code: <?php include "globals.php"; $ir['cybermoney'] = floor($ir['cybermoney']); if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } if($ir['location'] < 3) { die("You have to be in Neptune to access the Cyber Bank."); } $sql = ("SELECT * FROM `researchfund`"); $query = $db->query($sql); $row = $db->fetch_row($query); if($row['fund'] >= 35000000 OR $ir['screen'] == 1) { print "<h3>Cyber Bank</h3>"; if($ir['cybermoney']>-1) { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; } } else { if(isset($_GET['buy'])) { if($ir['money']>9999999) { print "Congratulations, you bought a bank account for £10,000,000! [url='cyberbank.php']Start using my account[/url]"; $db->query("UPDATE users SET money=money-10000000,cybermoney=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 bank account today, just £10,000,000! [url='cyberbank.php?buy']> Yes, sign me up![/url]"; } } function index() { global $db,$ir,$c,$userid,$h; print "\n[b]You currently have £{$ir['cybermoney']} in the bank.[/b] At the end of each day, your bank balance will go up by 10%. <table width='75%' border='2'> <tr> <td width='50%'>[b]Deposit Money[/b] It will cost you 15% of the money you deposit, rounded up. The maximum fee is £1,500,000.<form action='cyberbank.php?action=deposit' method='post'> Amount: <input type='text' name='deposit' value='{$ir['money']}' /> <input type='submit' value='Deposit' /></form></td> <td> [b]Withdraw Money[/b] It will cost you 7.5% of the money you withdraw, rounded up. The maximum fee is £750,000.<form action='cyberbank.php?action=withdraw' method='post'> Amount: <input type='text' name='withdraw' value='{$ir['cybermoney']}' /> <input type='submit' value='Withdraw' /></form></td> </tr> </table>"; } function deposit() { global $db,$ir,$c,$userid,$h; $_POST['deposit']=abs((float) $_POST['deposit']); if($_POST['deposit'] > $ir['money']) { print "You do not have enough money to deposit this amount."; } else { $fee=ceil($_POST['deposit']*15/100); if($fee > 1500000) { $fee=1500000; } $gain=$_POST['deposit']-$fee; $ir['cybermoney']+=$gain; $db->query("UPDATE users SET cybermoney=cybermoney+$gain, money=money-{$_POST['deposit']} where userid=$userid"); print "You hand over £{$_POST['deposit']} to be deposited, after the fee is taken (£$fee), £$gain is added to your account. [b]You now have £{$ir['cybermoney']} in the Cyber Bank.[/b] [url='cyberbank.php']> Back[/url]"; } } function withdraw() { global $db,$ir,$c,$userid,$h; $_POST['withdraw']=abs((float) $_POST['withdraw']); if($_POST['withdraw'] > $ir['cybermoney']) { print "You do not have enough banked money to withdraw this amount."; } else { $fee=ceil($_POST['withdraw']*75/1000); if($fee > 750000) { $fee=750000; } $gain=$_POST['withdraw']-$fee; $ir['cybermoney']-=$gain; $db->query("UPDATE users SET cybermoney=cybermoney-$gain, money=money+$gain where userid=$userid"); print "You ask to withdraw £$gain, the teller hands it over after she takes the bank fees. [b]You now have £{$ir['cybermoney']} in the Cyber Bank.[/b] [url='cyberbank.php']> Back[/url]"; } } } elseif($row['fund'] < 35000000 AND $ir['screen'] == 0) { die("You need to be screened first before you can access the Holiday Gym. Go <a href = 'screening.php' />HERE</a> to get screened."); } $h->endpage(); ?>   This is the code around line 28: print "<h3>Cyber Bank</h3>"; if($ir['cybermoney']>-1) { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; }   with index(); being line 28.   It was working fine until I added this bit in: $sql = ("SELECT * FROM `researchfund`"); $query = $db->query($sql); $row = $db->fetch_row($query); if($row['fund'] >= 35000000 OR $ir['screen'] == 1) {   so I'm not sure how to fix it. I've thought about how to fix it, but whatever I try doesn't seem to work. :( Any help will be much appreciated. I'm still a newbie at PHP and all help will help me learn and understand where I went wrong and how I can fix it. :)
  9. Re: Burn House for V2   Thanks. :) I'm still a newbie to PHP, so I'm still learning. :-P
  10. Re: Burn House for V2 I like your idea radio_active. :) That, too, is a good way of making it. Right, I think I've finished it now. Now, when you burn down another user's house, they will have to repair it before they can sell it, buy a new house or train. If you haven't done so already, create a file called burnhouse.php and paste this into it: <?php include "globals.php"; if($ir['energy'] < 10) { die("Sorry, it costs 10 energy to Arson a Home. You only have {$ir['energy']} energy. Come back later."); } if($ir['jail'] or $ir['hospital']) { die("You cannot Burn a House while in jail or hospital."); } switch($_GET['action']) { case 'search': search(); break; case 'searchsub': search_sub(); break; case 'pourpetrol': pour_petrol(); break; case 'burn': burn(); break; case 'repair': repair(); break; case 'repairsub': repair_sub(); break; default: index(); break; } function index() { global $db,$ir,$userid; $_GET['ID'] = abs((int) $_GET['ID']); $r = $db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); $cost = ($r['level'] * 200); if(!$r['userid']) { die("Invalid User"); } else { print "Would you like to burn down {$r['username']}'s home for £$t".money_formatter($cost,'')."? <form action = 'burnhouse.php?action=pourpetrol&ID={$_GET['ID']}' method = 'post' /> <input type = 'submit' value = 'YES' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'NO WAY' /> </form>"; } } function pour_petrol() { global $db,$ir,$userid; $_GET['ID'] = abs((int) $_GET['ID']); $r=$db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); $cost = ($r['level'] * 200); if($_GET['ID'] == $userid) { die("Only the Crazy Burn their own homes down."); } if(!$r['userid']) { die("Invalid user"); } if($ir['money'] < $cost) { die("You don't have enough money. <a href = 'bank.php' />Go Here</a> to get some more."); } if($ir['petrol'] == 0) { die("You can't burn down {$r['username']}'s house when you don't have any petrol. Search for some <a href = 'burnhouse.php?action=search' />HERE</a>."); } if($r['hrepair'] > 0) { die("This user's house is already burnt down. You can't burn it down again. <a href = 'index.php' />Go Home</a>"); } else { print "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? <form action = 'burnhouse.php?action=burn&ID={$_GET['ID']}' method = 'post' /> <input type = 'submit' value = 'Light Match' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'No, Go Home' /> </form>"; } } function burn() { global $db,$ir,$userid; if($_GET['ID'] == $userid) { die("Only the crazy burn down their own home down."); } $_GET['ID'] = abs((int) $_GET['ID']); $r = $db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); if(!$r['userid']) { die("Invalid User"); } if($ir['petrol'] == 0) { die("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($ir['matches'] == 0) { die("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 = $r['level'] * $r['level']; $chance = min(($ir['crimexp']/$mult) * 50+1, 95); $harm = rand(1,200); $cost = ($ir['level'] * 200); $repair = rand(6,20); if(rand(1,210) < $chance AND $harm < 190) { $gain=$r['level']*5; print "You light the match, drop it and run outside. You successfully burned {$r['username']} 's Home Down. > [url='index.php']Run Home[/url]"; $db->query(sprintf("UPDATE `users` SET `crimexp` = `crimexp` + '%d', `petrol` = `petrol` - '%d', `matches` = `matches` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $gain, 1, 1, $cost, $userid)); $db->query(sprintf("UPDATE `users` SET `will` = 0 WHERE `userid` = {$r['userid']}")); $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `hrepair` = '%d' WHERE `userid` = {$r['userid']}", 0, $repair)); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] Burned your House down. You lost all of your will and was let out of Jail if you were in jail. Click [url='burnhouse.php?action=pourpetrol&ID={$userid}']here[/url] to Arson their Home.", $c); } elseif(rand(1,210) < $chance AND $harm > 190) { $gain=$r['level']*5; $hosp = rand(300,500); $repair = rand(6,20); print "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. > [url='index.php']Go to Hospital[/url]"; $db->query(sprintf("UPDATE `users` SET `crimexp` = `crimexp` + '%d', `hospital` = '%d', `hospreason` = 'Caught alight when burning down a house', `petrol` = `petrol` - '%d', `matches` = `matches` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $gain, $hosp, 1, 1, $cost, $userid)); $db->query(sprintf("UPDATE `users` SET `will` = 0 WHERE `userid` = {$r['userid']}")); $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `hrepair` = '%d' WHERE `userid` = {$r['userid']}", 0, $repair)); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] 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 [url='burnhouse.php?action=pourpetrol&ID={$userid}']here[/url] to Arson their Home.", $c); } elseif(rand(1,210) > $chance AND $harm < 190) { $jailtime = min($mult, 100); $hospital = min(rand(60,200), 75); print "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. > <a href = 'jail.php' />Go to Jail</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Ran into a cop after attempting to arson a house', `money` = `money` - '%d', `matches` = `matches` - '%d', `petrol` = `petrol` - '%d' WHERE `userid` = ('%u')", $jailtime, $cost, 1, 1, $userid)); $db->query(sprintf("UPDATE `users` SET `hospital` = `hospital` + '%d', `hospreason` = 'Got burnt when their house was arsoned' WHERE `userid` = {$r['userid']}", $hospital)); event_add($r['userid'], "<a href = 'viewuser.php?u={$ir['userid']}' />{$ir['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.", $c); } elseif(rand(1,210) > $chance AND $harm > 190) { $jailtime = min($mult, 100); $hospital = min(rand(60,200), 75); $cost = ($r['level'] * 200); $repair = rand(6,20); print "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! > <a href = 'jail.php' />Go to Jail</a> > <a href = 'hospital.php' />Go to Hospital</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Got caught arsoning a house', `hospital` = '%d', `hospreason` = 'Got burnt when arsoning a house', `money` = `money` - '%d', `matches` = `matches` - '%d', `petrol` = `petrol` - '%d' WHERE `userid` = ('%u')", $jailtime, $hospital, $cost, 1, 1, $userid)); $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `will` = '%d', `hrepair` = '%d' WHERE `userid` = {$r['userid']}", 0, 0, $repair)); } elseif(rand(1,210) > $chance) { print "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!! > [url='jail.php']Go to Jail[/url]"; $time=min($mult, 100); $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Caught trying to Burn Down the Home of {$r['username']}', `petrol` = `petrol` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $time, 1, $cost, $userid)); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] was caught trying to Burn your house down.", $c); } else { print "You chicken out before you light the match. You quickly run out of the house and run home. You lose a gallon of petrol. > <a href = 'index.php' />Go Home</a>"; $db->query(sprintf("UPDATE `users` SET `petrol` = `petrol` - '%d' WHERE `userid` = ('%d')", 1, $userid)); } } } function search() { global $db,$ir,$userid; if($ir['warehouse'] == 5) { die("You've already searched the warehouse 5 times today. You're too tired to search it again. Come back tomorrow. <a href = 'index.php' />Go Home</a>"); } else { print "<h3 />Search for Petrol/Matches</h3> 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? <form action = 'burnhouse.php?action=searchsub' method = 'post' /> <input type = 'submit' value = 'Break In' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'Go Home' /> </form>"; } } function search_sub() { global $db,$ir,$userid; $search = rand(1,4); $cash = rand(200,800); $matches = rand(2,6); $petrol = rand(1,4); $jtime = rand(65,100); $pet = rand(6,8); $mat = rand(6,10); $big = rand(800,1000); if($ir['warehouse'] == 5) { die("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 "While searching the abandoned warehouse, you find $matches matches and $petrol gallons of petrol. Good job! <a href = 'index.php' />Go Home</a>."; $db->query(sprintf("UPDATE `users` SET `matches` = `matches` + '%d', `petrol` = `petrol` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $matches, $petrol, 1, $userid)); } elseif($search == 2) { print "While searching through the abandoned warehouse, you find nothing but \$$cash. Disappointed, you head <a href = 'index.php' />home</a>."; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $cash, 1, $userid)); } elseif($search == 3) { print "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. <a href = 'jail.php' />Go to Jail</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Got caught searching the warehouse', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $jtime, 1, $userid)); } elseif($search == 4) { print "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>."; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `matches` = `matches` + '%d', `petrol` = `petrol` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $big, $mat, $pet, 1, $userid)); } } } function repair() { global $db,$ir,$userid; $rcost = ($ir['hrepair'] * 1200); if($ir['hrepair'] == 0) { die("You don't need to repair your house. <a href = 'index.php' />Go Home</a>"); } else { print "<h2 />Repairing Your Home</h2> Welcome. Here, you can repair your home when it it burnt down. It will cost you £$t".money_formatter($rcost,'')." to repair your home. Would you like to repair your home? <form action = 'burnhouse.php?action=repairsub' method = 'post' /> <input type = 'submit' value = 'Yes' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'No' /> </form>"; } } function repair_sub() { global $db,$ir,$userid; $rcost = ($ir['hrepair'] * 1200); if($ir['hrepair'] == 0) { die("You don't need to repair your house. <a href = 'index.php' />Go Home</a>"); } if($ir['money'] < $rcost) { die("You don't have enough money to repair your house. You need £$t".money_formatter($rcost,'').". <a href = 'index.php' />Go Home</a>"); } else { print "<h2 />Repaired Your Home</h2> Congratulations. You paid £$t".money_formatter($rcost,'')." to repair your house. You can now train, sell your house or buy a new one. <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'Return Home' /> </form>"; $db->query(sprintf("UPDATE `users` SET `money` = `money` - '%d', `hrepair` = '%d' WHERE `userid` = ('%u')", $rcost, 0, $userid)); } } $h->endpage(); ?>   Then add this under include "globals.php"; in gym.php and estate.php: if($ir['hrepair'] > 0) { die("You need to repair your house first before you can access this page. Go <a href = 'burnhouse.php?action=repair' />HERE</a> to repair your house."); }   Then, run this SQL: ALTER TABLE `users` ADD `hrepair` INT(11) NOT NULL DEFAULT '0';   NOTE: If you haven't run the SQLs from my first post, you'll have to do so before this will work.   The price for burning down a house and repairing a house can easily be changed, but if you need help, just send me a message and I'll reply to it as soon as possible. :) Plus, if you find any errors, please post them and I'll fix them as soon as possible as well. I've tested it and it works fine. :) Although, you may need to change the £ signs to $ signs. ;) (If you use $'s in your game.)
  11. Re: Counting (nr game) 1954
  12. Re: A small cron problem Just turned 12am here and went to have a look in my investment bank.....and I received the correct amount of interest. Thank you for helping me. :) :) :)
  13. Re: A small cron problem Right. :) Thank you. I'll try that and hopefully at 00:00 BST I'll get the correct amount of interest. :) I'll make sure I only use one (=) in my crons from now on. Fortunately, I haven't needed to have (=) signs in any of my crons for the mods I've made so far, so this is lesson learned. :) Thank you.
  14. Re: Xp problem Hmm. I thought this was just the success formula. Isn't the amount of XP gained based on the money given when the crime is successfully committed? Then again, I could be wrong. My brother's game uses V2, and V1 could be different. :)
  15. Hi all. I've been having a little trouble with a new cron for a while now. It's for an investment mod a friend and I made. In the mod, the user can upgrade their contract with the investment company from level 0 to level 1, which gives more interest per day. My problem is that even if a user is at Level 1, they still receive 3.0% interest on their investment, instead of the 5.5% they're supposed to get at Level 1. Here is what I have in my cron_day.php: if($ir['investlevel'] == 1) { $db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*5.5) WHERE userBANKAMMT > 0"); } elseif($ir['investlevel'] == 0) { $db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*3.0) WHERE userBANKAMMT > 0"); }   I've tried different variations of the cron to get it to work. For example, I tried: $db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*3.0) WHERE userBANKAMMT > 0 AND investlevel == 0"); $db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*5.5) WHERE userBANKAMMT > 0 AND investlevel == 1");   but that didn't work either. :( So I'm a bit confused as to how to get this cron to work. I am still a newbie coder so I'm still learning. :) Any help will be highly appreciated. :)
  16. Re: Burn House for V2 OK. I was going to add something to the one I posted but never got round to it: The user has to repair their house every time their house is burned down. While their house is damaged, they can't sell their house or train. The user would have to repair their house by paying a repair fee, which could be changed easily. This wouldn't be a new outcome. I'd just have to update the queries in this mod, update the sell function in the estate.php and update the gym.php. I'll see what I can do. It shouldn't be too hard. ;)
  17. Re: Burn House for V2 Would you want that as a possible outcome to join the other outcomes or that it is guaranteed to make the other user lose their house? If you were to have that, you'd have to make it a lot harder for somebody to burn down another's house, otherwise the users would get rather annoyed that they keep losing their very expensive house, if they have one. ;)
  18. War_Hero

    WWII

    Re: WWII Italy - 12 Japan - 20 Great Britain - 47 United States - 20 Soviet Union - 20 France - 20
  19. Re: Burn House for V2 OK. I believe this one should work. :) I've tested it and haven't found any errors. But since there are quite a few outcomes, I may have missed an error, but hopefully not. ;) Here it is: <?php include "globals.php"; if($ir['energy'] < 10) { die("Sorry, it costs 10 energy to Arson a Home. You only have {$ir['energy']} energy. Come back later."); } if($ir['jail'] or $ir['hospital']) { die("You cannot Burn a House while in jail or 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 $db,$ir,$userid; $_GET['ID'] = abs((int) $_GET['ID']); $r = $db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); $cost = ($r['level'] * 200); if(!$r['userid']) { die("Invalid User"); } else { print "Would you like to burn down {$r['username']}'s home for \$$t".money_formatter($cost,'')."? <form action = 'burnhouse.php?action=pourpetrol&ID={$_GET['ID']}' method = 'post' /> <input type = 'submit' value = 'YES' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'NO WAY' /> </form>"; } } function pour_petrol() { global $db,$ir,$userid; $_GET['ID'] = abs((int) $_GET['ID']); $r=$db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); $cost = ($r['level'] * 200); if($_GET['ID'] == $userid) { die("Only the Crazy Burn their own homes down."); } if(!$r['userid']) { die("Invalid user"); } if($ir['money'] < $cost) { die("You don't have enough money. <a href = 'bank.php' />Go Here</a> to get some more."); } if($ir['petrol'] == 0) { die("You can't burn down {$r['username']}'s house when you don't have any petrol. Search for some <a href = 'burnhouse.php?action=search' />HERE</a>."); } else { print "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? <form action = 'burnhouse.php?action=burn&ID={$_GET['ID']}' method = 'post' /> <input type = 'submit' value = 'Light Match' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'No, Go Home' /> </form>"; } } function burn() { global $db,$ir,$userid; if($_GET['ID'] == $userid) { die("Only the crazy burn down their own home down."); } $_GET['ID'] = abs((int) $_GET['ID']); $r = $db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); if(!$r['userid']) { die("Invalid User"); } if($ir['petrol'] == 0) { die("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($ir['matches'] == 0) { die("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 = $r['level'] * $r['level']; $chance = min(($ir['crimexp']/$mult) * 50+1, 95); $harm = rand(1,200); $cost = ($ir['level'] * 200); if(rand(1,210) < $chance AND $harm < 190) { $gain=$r['level']*5; print "You light the match, drop it and run outside. You successfully burned {$r['username']} 's Home Down. > [url='index.php']Run Home[/url]"; $db->query(sprintf("UPDATE `users` SET `crimexp` = `crimexp` + '%d', `petrol` = `petrol` - '%d', `matches` = `matches` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $gain, 1, 1, $cost, $userid)); $db->query(sprintf("UPDATE `users` SET `will` = 0 WHERE `userid` = {$r['userid']}")); $db->query(sprintf("UPDATE `users` SET `jail` = 0 WHERE `userid` = {$r['userid']}")); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] Burned your House down. You lost all of your will and was let out of Jail if you were in jail. Click [url='burnhouse.php?action=pourpetrol&ID={$userid}']here[/url] to Arson their Home.", $c); } elseif(rand(1,210) < $chance AND $harm > 190) { $gain=$r['level']*5; $hosp = rand(300,500); print "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. > [url='index.php']Go to Hospital[/url]"; $db->query(sprintf("UPDATE `users` SET `crimexp` = `crimexp` + '%d', `hospital` = '%d', `hospreason` = 'Caught alight when burning down a house', `petrol` = `petrol` - '%d', `matches` = `matches` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $gain, $hosp, 1, 1, $cost, $userid)); $db->query(sprintf("UPDATE `users` SET `will` = 0 WHERE `userid` = {$r['userid']}")); $db->query(sprintf("UPDATE `users` SET `jail` = 0 WHERE `userid` = {$r['userid']}")); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] 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 [url='burnhouse.php?action=pourpetrol&ID={$userid}']here[/url] to Arson their Home.", $c); } elseif(rand(1,210) > $chance AND $harm < 190) { $jailtime = min($mult, 100); $hospital = min(rand(60,200), 75); print "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. > <a href = 'jail.php' />Go to Jail</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Ran into a cop after attempting to arson a house', `money` = `money` - '%d', `matches` = `matches` - '%d', `petrol` = `petrol` - '%d' WHERE `userid` = ('%u')", $jailtime, $cost, 1, 1, $userid)); $db->query(sprintf("UPDATE `users` SET `hospital` = `hospital` + '%d', `hospreason` = 'Got burnt when their house was arsoned' WHERE `userid` = {$r['userid']}", $hospital)); event_add($r['userid'], "<a href = 'viewuser.php?u={$ir['userid']}' />{$ir['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.", $c); } elseif(rand(1,210) > $chance AND $harm > 190) { $jailtime = min($mult, 100); $hospital = min(rand(60,200), 75); $cost = ($r['level'] * 200); print "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! > <a href = 'jail.php' />Go to Jail</a> > <a href = 'hospital.php' />Go to Hospital</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Got caught arsoning a house', `hospital` = '%d', `hospreason` = 'Got burnt when arsoning a house', `money` = `money` - '%d', `matches` = `matches` - '%d', `petrol` = `petrol` - '%d' WHERE `userid` = ('%u')", $jailtime, $hospital, $cost, 1, 1, $userid)); $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `will` = '%d' WHERE `userid` = {$r['userid']}", 0, 0)); } elseif(rand(1,210) > $chance) { print "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!! > [url='jail.php']Go to Jail[/url]"; $time=min($mult, 100); $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Caught trying to Burn Down the Home of {$r['username']}', `petrol` = `petrol` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $time, 1, $cost, $userid)); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] was caught trying to Burn your house down.", $c); } else { print "You chicken out before you light the match. You quickly run out of the house and run home. You lose a gallon of petrol. > <a href = 'index.php' />Go Home</a>"; $db->query(sprintf("UPDATE `users` SET `petrol` = `petrol` - '%d' WHERE `userid` = ('%d')", 1, $userid)); } } } function search() { global $db,$ir,$userid; if($ir['warehouse'] == 5) { die("You've already searched the warehouse 5 times today. You're too tired to search it again. Come back tomorrow. <a href = 'index.php' />Go Home</a>"); } else { print "<h3 />Search for Petrol/Matches</h3> 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? <form action = 'burnhouse.php?action=searchsub' method = 'post' /> <input type = 'submit' value = 'Break In' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'Go Home' /> </form>"; } } function search_sub() { global $db,$ir,$userid; $search = rand(1,4); $cash = rand(200,800); $matches = rand(2,6); $petrol = rand(1,4); $jtime = rand(65,100); $pet = rand(6,8); $mat = rand(6,10); $big = rand(800,1000); if($ir['warehouse'] == 5) { die("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 "While searching the abandoned warehouse, you find $matches matches and $petrol gallons of petrol. Good job! <a href = 'index.php' />Go Home</a>."; $db->query(sprintf("UPDATE `users` SET `matches` = `matches` + '%d', `petrol` = `petrol` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $matches, $petrol, 1, $userid)); } elseif($search == 2) { print "While searching through the abandoned warehouse, you find nothing but \$$cash. Disappointed, you head <a href = 'index.php' />home</a>."; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $cash, 1, $userid)); } elseif($search == 3) { print "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. <a href = 'jail.php' />Go to Jail</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Got caught searching the warehouse', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $jtime, 1, $userid)); } elseif($search == 4) { print "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>."; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `matches` = `matches` + '%d', `petrol` = `petrol` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $big, $mat, $pet, 1, $userid)); } } } $h->endpage(); ?>   Make sure you've run the SQLs and cron as well. :)
  20. Re: Burn House for V2 Sorry all for not replying. I got back from Belgium yesterday and didn't have time to go onto the computer at all. I'll post the fix on here when I can. Plus, I added a new outcome or two. I might try to code in a repair feature, that doesn't allow the user who's house has been burned down to train or sell their house until they've fixed/repaired their house. :)   And thank you z-e-r-o. :) I'm still a newbie coder, so I'll agree it's not best. ;)
  21. Re: Burn House for V2 Hmm, that's very strange. I tested it before I posted it and all the outcomes worked. I'll have a look at it and see what's wrong. :)
  22. Re: Burn House for V2 Okay, here's the mod. If you use it please post here and if you find any errors, please post them here and I will sort them out when I can. :) Step 1 Create file called burnhouse.php and post this code into it: <?php include "globals.php"; if($ir['energy'] < 10) { die("Sorry, it costs 10 energy to Arson a Home. You only have {$ir['energy']} energy. Come back later."); } if($ir['jail'] or $ir['hospital']) { die("You cannot Burn a House while in jail or 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 $db,$ir,$userid; $_GET['ID'] = abs((int) $_GET['ID']); $r = $db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); $cost = ($r['level'] * 200); if(!$r['userid']) { die("Invalid User"); } else { print "Would you like to burn down {$r['username']}'s home for \$$t".money_formatter($cost,'')."? <form action = 'burnhouse.php?action=pourpetrol&ID={$_GET['ID']}' method = 'post' /> <input type = 'submit' value = 'YES' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'NO WAY' /> </form>"; } } function pour_petrol() { global $db,$ir,$userid; $_GET['ID'] = abs((int) $_GET['ID']); $r=$db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); $cost = ($r['level'] * 200); if($_GET['ID'] == $userid) { die("Only the Crazy Burn their own homes down."); } if(!$r['userid']) { die("Invalid user"); } if($ir['money'] < $cost) { die("You don't have enough money. <a href = 'bank.php' />Go Here</a> to get some more."); } if($ir['petrol'] == 0) { die("You can't burn down {$r['username']}'s house when you don't have any petrol. Search for some <a href = 'burnhouse.php?action=search' />HERE</a>."); } else { print "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? <form action = 'burnhouse.php?action=burn&ID={$_GET['ID']}' method = 'post' /> <input type = 'submit' value = 'Light Match' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'No, Go Home' /> </form>"; } } function burn() { global $db,$ir,$userid; if($_GET['ID'] == $userid) { die("Only the crazy burn down their own home down."); } $_GET['ID'] = abs((int) $_GET['ID']); $r = $db->fetch_row($db->query("SELECT * FROM `users` WHERE `userid` = {$_GET['ID']}")); if(!$r['userid']) { die("Invalid User"); } elseif($ir['matches'] == 0) { die("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 = $r['level'] * $r['level']; $chance = min(($ir['crimexp']/$mult) * 50+1, 95); $harm = rand(1,200); $cost = ($ir['level'] * 200); if(rand(1,300) < $chance AND $harm < 190) { $gain=$r['level']*5; print "You light the match, drop it and run outside. You successfully burned {$r['username']} 's Home Down. > [url='index.php']Run Home[/url]"; $db->query(sprintf("UPDATE `users` SET `crimexp` = `crimexp` + '%d', `petrol` = `petrol` - '%d', `matches` = `matches` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $gain, 1, 1, $cost, $userid)); $db->query(sprintf("UPDATE `users` SET `will` = 0 WHERE `userid` = {$r['userid']}")); $db->query(sprintf("UPDATE `users` SET `jail` = 0 WHERE `userid` = {$r['userid']}")); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] Burned your House down. You lost all of your will and was let out of Jail if you were in jail. Click [url='burnhouse.php?action=pourpetrol&ID={$userid}']here[/url] to Arson their Home.", $c); } elseif(rand(1,300) < $chance AND $harm > 190) { $gain=$r['level']*5; $hosp = rand(300,500); print "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. > [url='index.php']Go to Hospital[/url]"; $db->query(sprintf("UPDATE `users` SET `crimexp` = `crimexp` + '%d', `hospital` = '%d', `hospreason` = 'Caught alight when burning down a house', `petrol` = `petrol` - '%d', `matches` = `matches` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $gain, $hosp, 1, 1, $cost, $userid)); $db->query(sprintf("UPDATE `users` SET `will` = 0 WHERE `userid` = {$r['userid']}")); $db->query(sprintf("UPDATE `users` SET `jail` = 0 WHERE `userid` = {$r['userid']}")); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] 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 [url='burnhouse.php?action=pourpetrol&ID={$userid}']here[/url] to Arson their Home.", $c); } else { if(rand(1,300) > $chance) { print "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!! > [url='jail.php']Go to Jail[/url]"; $time=min($mult, 100); $db->query(sprintf("UPDATE `users` SET `jail` = '%d', `jail_reason` = 'Caught trying to Burn Down the Home of {$r['username']}', `petrol` = `petrol` - '%d', `money` = `money` - '%d' WHERE `userid` = ('%u')", $time, 1, $cost, $userid)); event_add($r['userid'], "[url='viewuser.php?u={$ir[']{$ir['username']}[/url] was caught trying to Burn your house down.", $c); } } } } function search() { global $db,$ir,$userid; if($ir['warehouse'] == 5) { die("You've already searched the warehouse 5 times today. You're too tired to search it again. Come back tomorrow. <a href = 'index.php' />Go Home</a>"); } else { print "<h3 />Search for Petrol/Matches</h3> 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? <form action = 'burnhouse.php?action=searchsub' method = 'post' /> <input type = 'submit' value = 'Break In' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'Go Home' /> </form>"; } } function search_sub() { global $db,$ir,$userid; $search = rand(1,4); $cash = rand(200,800); $matches = rand(2,6); $petrol = rand(1,4); $jtime = rand(65,100); $pet = rand(6,8); $mat = rand(6,10); $big = rand(800,1000); if($ir['warehouse'] == 5) { die("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 "While searching the abandoned warehouse, you find $matches matches and $petrol gallons of petrol. Good job! <a href = 'index.php' />Go Home</a>."; $db->query(sprintf("UPDATE `users` SET `matches` = `matches` + '%d', `petrol` = `petrol` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $matches, $petrol, 1, $userid)); } elseif($search == 2) { print "While searching through the abandoned warehouse, you find nothing but \$$cash. Disappointed, you head <a href = 'index.php' />home</a>."; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d' `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $cash, 1, $userid)); } elseif($search == 3) { print "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. <a href = 'jail.php' />Go to Jail</a>"; $db->query(sprintf("UPDATE `users` SET `jail` = '%d' `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $jtime, 1, $userid)); } elseif($search == 4) { print "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>."; $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `matches` = `matches` + '%d', `petrol` = `petrol` + '%d', `warehouse` = `warehouse` + '%d' WHERE `userid` = ('%u')", $big, $mat, $pet, 1, $userid)); } } } $h->endpage(); ?>   Step 2 Run these SQLs: ALTER TABLE `users` ADD `warehouse` INT(11) NOT NULL DEFAULT '0', ADD `matches` INT(11) NOT NULL DEFAULT '0', ADD `petrol` INT(11) NOT NULL DEFAULT '0';   Step 3 Run this cron in cron_day.php: $db->query("UPDATE `users` SET `warehouse` = 0");   and you're done. Again, if you find any errors, please post here. I'll fix them when I can, as I'm about to go out. And, if you need any help changing any of the forumlas, please message me and I'll help you. I'm still a newbie coder, so it's not the best. ;) Hope you like it though. :)
  23. Re: Burn House for V2 Ok. I'll do that :) But before I post it I'll have to sort out that success outcome! It's annoying me! lol :-P
  24. Re: Burn House for V2 I've nearly finished mine, but I'm trying to fix an error at the moment. It just won't work! Most of it works, just one of the outcome of burning the house doesn't work. :( But I'll do my best to fix it. Also, I haven't made it so that it takes money. I could do it, if you want. I think I may have mis-read the first post. But, radio_active, I think yours might be better as I'm still a newbie coder. ;)
  25. Re: Burn House for V2 I'll give it a go. But I can't promise anything as I'm still a newbie coder. ;)
×
×
  • Create New...