
War_Hero
Members-
Posts
232 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by War_Hero
-
Hi all. I'm having a bit of trouble with an inventory/item query. I'm trying to select an item and it's quantity from the inventory, then compare it against a pre-defined variable. If the quantity is smaller than the predefined variable, a die() statement is outputted. However, even if I have enough of the item, it still outputs the die() statement. I'll post the bit of code that I'm working with. $id = $db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid = 107 WHERE iv.inv_userid = $userid LIMIT 1"); $r = $db->fetch_row($id); And the IF and DIE statements: elseif($r['inv_qty'] < $db_config['gym1bricks']) { die("You have bricks, but you don't have enough. Go <a href = 'buildgym.php?action=buybricks' />here</a> to buy some."); } $db_config['gym1bricks'] is set to 3840. Yet, even if I have 40000, I still get the DIE() statement. This is really getting to me now, as this is simple...ish, but I can't wrap my head around it. Can anyone help me? Any help will be highly appreciated. :)
-
[mccode v2] Very simple travel time mod.
War_Hero replied to shaved92bravada's topic in Free Modifications
Re: [mccode V2] Very simple travel time mod. Nah, I don't mind. :) I use the travellingglobals in the travel mod I have as well. Nice mod mate. Keep it up. :) -
Re: [mccode v2] Lucky Bags Try this: <?php require('./globals.php'); switch($_GET['action']) { case 'open': open(); break; case 'buy': buy(); break; default: index(); break; } function index() { global $db, $ir, $userid; echo'Welcome to the Lucky Bag center. You have <font color = "red">' .$ir['luckybags']. '</font> luckybags. Below, you can buy upto 2 grab bags for $2,000 each. Every bag will contain a random amount of cash, crystals or an item. Will it be your lucky day today? Click the link below to buy a lucky bag. <center><a href = "luckybag.php?action=buy">Buy a Lucky Bag</a> <a href = "luckybag.php?action=open">Open your Lucky Bag</a></center>'; } function buy () { global $db, $ir, $userid; $total = 2; $buy = $_POST['qty']; if($_POST['buy']) { $cost = $_POST['qty'] * 2000; if(!is_numeric($_POST['qty'])) { die('Your quantity must be numeric'); } if(!isset($_POST['qty'])) { die('You must enter how many bags you would like to purchase'); } if($ir['money'] < $cost) { die('You do not have enough money to buy this amount of bags!'); } if($ir['luckybags'] + $buy > $total) { die('You can only have 2 Lucky Bags at once'); } $db->query(sprintf("UPDATE `users` SET `money` = `money` - '%d', `luckybags` = `luckybags` + '%d' WHERE `userid` = ('%u')", $cost, $_POST['qty'], $userid)); echo'You have purchased ' .$_POST['qty']. ' Lucky Bags'; } else { echo' <form action = "luckybag.php?action=buy" method = "post"> Quantity: <input type = "text" value = "" name = "qty"> <input type = "submit" value = "Buy Lucky Bags" name = "buy"> </form>'; } } function open() { global $db, $ir, $userid; if($ir['luckybags'] == 0) { die('You do not have any Bags to open'); } else { $rand = rand(1,3); if($rand == 1) { $money = rand(0,2400); $bag = ($ir['luckybags']); $db->query(sprintf("UPDATE `users` SET `money` = `money` + '%d', `luckybags` = `luckybags` - '%d' WHERE `userid` = ('%u')", $money, 1, $userid)); echo'You opened a Lucky Bag and gained $' .$money. ' from it'; } if($rand == 2) { $crystals = rand(0,100); $db->query(sprintf("UPDATE `users` SET `crystals` = `crystals` + '%d', `luckybags` = `luckybags` - '%d' WHERE `userid` = ('%u')", $crystals, 1, $userid)); echo'You opened a Lucky Bag and gained ' .$crystals. ' crystals from it'; } if($rand == 3) { $query = $db->query("SELECT * FROM `items` WHERE `itmid` > 'item IDs here for what items you wan to be given out'"); $num = $db->num_rows($query); $item = rand(1,$num); $sql = sprintf("SELECT `itmname` FROM `items` WHERE `itmid` = ('%u')", $item); $itm = $db->fetch_row($db->query($sql)); $db->query(sprintf("UPDATE `users` SET `luckybags` = `luckybags` - '%d' WHERE `userid` = ('%u')", 1, $userid)); $db->query("INSERT INTO inventory VALUES('',$item,$userid,1)",$c); echo'You opened a Lucky Bag and received the item: ' .$itm['itmname']. ' from it'; } } } $h->endpage; ?> :)
-
Re: Modified Libary for V2 if($ir['donatordays'] < 0) That would mean anyone could use it, as everyone's donator days are either 0 or greater. It should be if($ir['donatordays'] <= 0) { die("<center />Hey. This feature is for donators only. Donate to the <a href = 'donator.php' />HERE...</a></center>"); } or you could use the if($ir['donatordays'] < 1) :)
-
Re: [mccodes V2] Bounty Hunter Game Thank you. :)
-
Re: [mccodes V2] Bounty Hunter Game Nah, it wasn't. I missed a ' in one of the queries and it was producing a query error. :-P Only a small minor error. ;)
-
Re: [mccodes V2] Bounty Hunter Game That's an idea. I may add that in later when I have the time. I'm currently working on another mod. :) By the way all, replace the whole script with this: <?php include "globals.php"; if($ir['jail'] OR $ir['hospital']) { die("<font color = 'red' /><b />Sorry. You can not access this page when in jail or hospital."); } print "<h1 />Bounty Hunter</h1> "; switch($_GET['action']) { case 'lifeinsurance': life_insurance(); break; case 'lifeinssubmit': lifeins_submit(); break; case 'joinbounty': join_bounty(); break; case 'confirm': confirm(); break; case 'locationsearch': location_search(); break; default: index(); break; } function index() { global $db,$ir,$userid; $prize = '?400'; //** The prize if the bounty is found **// $cost = 200; //** Cost of entry **// $level = $ir['level']; $entrance = $cost * $level; if($ir['bountyhunt'] == 1) { die("You're already in a bounty hunt. Click <a href = 'bounty.php?action=locationsearch' />here</a> to continue."); } else { print "Welcome to the bounty hunter. There is a bounty at large and you can help catch him/her! If you catch the bounty, you will get a reward of $prize million. But, before you can join, you need to get some <a href = 'bounty.php?action=lifeinsurance' />life insurance</a>. If you'd like to join, it will cost you $t".money_formatter($entrance).". Click below to join the bounty hunt: <form action = 'bounty.php?action=joinbounty' method = 'post' /> <input type = 'submit' value = 'Join' /> </form>"; } } function life_insurance() { global $db,$ir,$userid; $_POST['lins'] = abs((int) $_POST['lins']); $price = ($ir['level'] * 850); //** Change this formula to the price you want for life insurance **// $getins = $_POST['lins']; $insurance = $price * $getins; print "<h2 />Getting Life Insurance</h2> Welcome. To get life insurance, it will cost you $t".money_formatter($price)." times the amount of life insurance you buy. <font color = 'yellow' />You currently have {$ir['lifeins']} life insurance.</font> Fill in the form below to get life insurance: <form action = 'bounty.php?action=lifeinssubmit' method = 'post' /> <input type = 'text' name = 'lins' value = '1' /> <input type = 'submit' value = 'Get life insurance' /> </form> or click <a href = 'bounty.php' />here</a> to go back."; } function lifeins_submit() { global $db,$ir,$userid; $_POST['lins'] = abs((int) $_POST['lins']); $price = ($ir['level'] * 850); //** Change this formula to the price you want for life insurance **// $getins = $_POST['lins']; $insurance = $price * $getins; $LIlimit = 15; //** Change this to the max amount of life insurance a user can buy at one time **// print "<h2 />Paying for Life Insurance</h2> "; if($ir['money'] < $insurance) { die("Sorry. You don't have enough money to get life insurance. Please come back later."); } elseif($_POST['lins'] > $LIlimit) { die("You can not buy more than $LIlimit life insurance at once."); } else { print "You've now got life insurance. If you get injured or come back to join another bounty hunt, life insurance may be more expensive. <a href = 'bounty.php' />Return to bounty hunt</a>."; $lifeinssql = sprintf("UPDATE `users` SET `money` = `money` - '%d', `lifeins` = `lifeins` + '%d' WHERE `userid` = ('%u')", $insurance, $_POST['lins'], $userid); $db->query($lifeinssql); } } function join_bounty() { global $db,$ir,$userid; $cost = 200; //** Cost of entry **// $level = $ir['level']; $entrance = $cost * $level; if($ir['lifeins'] <= 0) { die("You need <a href = 'bounty.php?action=lifeinsurance' />life insurance</a> before you can join the bounty hunt."); } elseif($ir['bountyhunt'] > 0) { die("You're already involved in a bounty hunt. <a href = 'bounty.php?action=locationsearch' />Continue</a>."); } else { print "Here, you can join the bounty hunt. It will cost you $t".money_formatter($entrance)." to enter. You can choose from two different search parties: <font color = 'blue' /> <ul /> <li />Search Party 1 - 30 minutes <li />Search Party 2 - 60 minutes [/list] </font> Please choose complete the form below: <form action = 'bounty.php?action=confirm' method = 'post' /> Search Party: <select name = 'searchtype' type = 'dropdown' /> <option value = '1' />Search Party 1</option> <option value = '2' />Search Party 2</option> </select> Search Location: <select name = 'locationnum' type = 'dropdown' /> <option value = '1' />City Centre</option> <option value = '2' />Outskirts</option> <option value = '3' />The Underground</option> </select> <input type = 'submit' value = 'Confirm Details' /> </form>"; } } function confirm() { global $db,$ir,$userid; $cost = 200; //** Cost of entry **// $level = $ir['level']; $entrance = $cost * $level; $time = $_POST['searchtype'] * 30; if($ir['money'] < $entrance) { die("You don't have enough money to join. Go <a href = 'bank.php' />here</a> to get some more."); } elseif(($_POST['searchtype'] == 1) AND ($_POST['locationnum'] == 3)) { die("You can not search the Underground with Search Party 1. Go <a href = 'bounty.php' />back</a> and sign up again."); } else { print "You will be searching with your chosen party for the bounty. <font color = 'red' />You CAN NOT change your details now.</font> Click <a href = 'bounty.php?action=locationsearch' />HERE</a> to begin the search."; $confirm1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `money` = `money` - '%d', `bhlocation` = '%d', `bhparty` = '%d', `searchtime` = '%d' WHERE `userid` = ('%u')", 1, $entrance, $_POST['locationnum'], $_POST['searchtype'], $time, $userid); $db->query($confirm1); } } function location_search() { global $db,$ir,$userid; $chance1 = rand(1,500); //** Change this to set the chance of finding the bounty with Search Party 1 in location 1 **// $bound1a = 400; $bound1b = 415; $chance2 = rand(1,1000); //** Change this to set the chance of finding the bounty with Search Party 1 in location 2 **// $bound2a = 705; $bound2b = 708; $chance3 = rand(1,800); //** Change this to set the chance of finding the bounty with Search Party 2 in location 1 **// $bound3a = 205; $bound3b = 320; $jail = rand(70,140); //** Change this to your preferred jail sentence **// $chance4 = rand(1,1300); //** Change this to set the chance of finding the bounty with Search Party 2 in location 2 **// $bound4a = 500; $bound4b = 680; $hospitalchance = rand(201,270); //** Change this to set the chance of going to hospital **// $hospital = rand(200,330); //** Change this to set the hospital time **// $chance5 = rand(500,4000); //** Change this to set the chance of finding the bounty with Search Party 2 in location 3 **// $bound5a = 600; $bound5b = 1680; $prize2 = 400000000; //** Change this to match your prize choice from the function: index() **// if($ir['bountyhunt'] != 1) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> the bounty hunt before you can search."); } //** Search Party 1 -- Location 1 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: City Centre</h2> You're currently searching in the City Centre with Search Party 1. Visit this page when you've finished searching in {$ir['searchtime']} minutes. <a href = 'index.php' />Home</a>"; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance1 >= $bound1a) AND ($chance1 <= $bound1b)) { print "Congratulations! You and Search Party 1 found the bounty in the City Centre. You receive $t".money_formatter($prize2)." as a reward! However, you have lost 1 life insurance due to the risk of the hunt."; $won1 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($won1); } else { print "Unfortunately you didn't find the bounty in the City Centre. You'll need to <a href = 'bounty.php?action=joinbounty' />join up</a> again if you want to have another look for the bounty."; $lost1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", 0, 0, 0, 1, $userid); $db->query($lost1); } } //** Search Party 1 -- Location 2 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: Outskirts</h2> You're currently searching in the Outskirts with Search Party 1. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance2 >= $bound2a) AND ($chance2 <= $bound2b)) { print "Congratulations! You and Search Party 1 found the bounty hiding in the outskirts of the city. You receive $t".money_formatter($prize)." as a reward, but your life insurance goes down due to the risk you put yourself through."; $won2 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", $prize, 0, 0, 1, 0, $userid); $db->query($won2); } else { print "Unfortunately you didn't find the bounty in the outskirts. You'll have to <a href = 'bounty.php?action=joinbounty' />join up</a> again to search another time."; $lost2 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost2); } } //** Search Party 2 -- Location 1 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: City Centre</h2> You're currently searching in the City Centre with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance >= $bound3a) AND ($chance <= $bound3b)) { print "Congratulations! You and Search Party 2 found the bounty lurking around the streets of the City Centre. You receive $t".money_formatter($prize2)." as a reward. Your life insurance goes down, however."; $won3 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `bountyhunt` = '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, 0, $userid); $db->query($won3); } else { print "Unfortunately you didn't find the bounty in the City Centre. You also got nicked by the cops for searching through an abandoned building. You go to jail for $jail minutes."; $lost3 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `jail` = '%d', `jail_reason` = 'Got caught searching for the bounty' WHERE `userid` = ('%u')", 0, 0, 0, 1, $jail, $userid); $db->query($lost3); } } //** Search Party 2 -- Location 2 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: Outskirts</h2> You're currently searching in the Outskirts of the city with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance4 >= $bound4a) AND ($chance4 <= $bound4b)) { if($hospitalchance <= $chance4) { print "Congratulations. You successfully caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward, but you also go to hospital with a few major injuries. The bounty put up a big fight as you caught him."; $win4a = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `hospital` = '%d', `hospreason` = 'Was beaten up by the bounty' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $hospital, $userid); $db->query($win4a); } else { print "Congratulations! You and Search Party 2 caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward. Good job!"; $win4b = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win4b); } } else { print "Unfortunately you and Search Party 2 didn't find the bounty anywhere. Better luck next time. <a href = 'bounty.php?action=joinbounty' />Join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } //** Search Party 2 -- Location 3 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: The Underground</h2> You're currently seaching the Underground with Search Party 2. Check this page again when you've finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] == 0)) { if(($chance5 >= $bound5a) AND ($chance5 <= $bound5b)) { print "Congratulations! You and Search Party 2 found and captured the bounty in the Underground of the city. You receive $t".money_formatter($prize2)." as a reward for the bounty's capture."; $win5 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win5); } else { print "Unfortunately you didn't find the bounty. You will have to <a href = 'bounty.php?action=joinbounty' />join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } } $h->endpage(); ?> I found an error in one of the queries. :-P
-
Re: [mccodes V2] Bounty Hunter Game Oh. That's strange as it's works perfectly for me. There must be something that you're doing wrong. :-P I'll do a few more test to see if there is an error in the code.
-
Re: [mccodes V2] Bounty Hunter Game Hi all. Sorry it's taken such a long time for a simple re-do of the mod. I've been really busy. Replace your bounty.php with this: <?php include "globals.php"; if($ir['jail'] OR $ir['hospital']) { die("<font color = 'red' /><b />Sorry. You can not access this page when in jail or hospital."); } print "<h1 />Bounty Hunter</h1> "; switch($_GET['action']) { case 'lifeinsurance': life_insurance(); break; case 'lifeinssubmit': lifeins_submit(); break; case 'joinbounty': join_bounty(); break; case 'confirm': confirm(); break; case 'locationsearch': location_search(); break; default: index(); break; } function index() { global $db,$ir,$userid; $prize = '?400'; //** The prize if the bounty is found **// $cost = 200; //** Cost of entry **// $level = $ir['level']; $entrance = $cost * $level; if($ir['bountyhunt'] == 1) { die("You're already in a bounty hunt. Click <a href = 'bounty.php?action=locationsearch' />here</a> to continue."); } else { print "Welcome to the bounty hunter. There is a bounty at large and you can help catch him/her! If you catch the bounty, you will get a reward of $prize million. But, before you can join, you need to get some <a href = 'bounty.php?action=lifeinsurance' />life insurance</a>. If you'd like to join, it will cost you $t".money_formatter($entrance).". Click below to join the bounty hunt: <form action = 'bounty.php?action=joinbounty' method = 'post' /> <input type = 'submit' value = 'Join' /> </form>"; } } function life_insurance() { global $db,$ir,$userid; $_POST['lins'] = abs((int) $_POST['lins']); $price = ($ir['level'] * 850); //** Change this formula to the price you want for life insurance **// $getins = $_POST['lins']; $insurance = $price * $getins; print "<h2 />Getting Life Insurance</h2> Welcome. To get life insurance, it will cost you $t".money_formatter($price)." times the amount of life insurance you buy. <font color = 'yellow' />You currently have {$ir['lifeins']} life insurance.</font> Fill in the form below to get life insurance: <form action = 'bounty.php?action=lifeinssubmit' method = 'post' /> <input type = 'text' name = 'lins' value = '1' /> <input type = 'submit' value = 'Get life insurance' /> </form> or click <a href = 'bounty.php' />here</a> to go back."; } function lifeins_submit() { global $db,$ir,$userid; $_POST['lins'] = abs((int) $_POST['lins']); $price = ($ir['level'] * 850); //** Change this formula to the price you want for life insurance **// $getins = $_POST['lins']; $insurance = $price * $getins; $LIlimit = 15; //** Change this to the max amount of life insurance a user can buy at one time **// print "<h2 />Paying for Life Insurance</h2> "; if($ir['money'] < $insurance) { die("Sorry. You don't have enough money to get life insurance. Please come back later."); } elseif($_POST['lins'] > $LIlimit) { die("You can not buy more than $LIlimit life insurance at once."); } else { print "You've now got life insurance. If you get injured or come back to join another bounty hunt, life insurance may be more expensive. <a href = 'bounty.php' />Return to bounty hunt</a>."; $lifeinssql = sprintf("UPDATE `users` SET `money` = `money` - '%d', `lifeins` = `lifeins` + '%d' WHERE `userid` = ('%u')", $insurance, $_POST['lins'], $userid); $db->query($lifeinssql); } } function join_bounty() { global $db,$ir,$userid; $cost = 200; //** Cost of entry **// $level = $ir['level']; $entrance = $cost * $level; if($ir['lifeins'] <= 0) { die("You need <a href = 'bounty.php?action=lifeinsurance' />life insurance</a> before you can join the bounty hunt."); } elseif($ir['bountyhunt'] > 0) { die("You're already involved in a bounty hunt. <a href = 'bounty.php?action=locationsearch' />Continue</a>."); } else { print "Here, you can join the bounty hunt. It will cost you $t".money_formatter($entrance)." to enter. You can choose from two different search parties: <font color = 'blue' /> <ul /> <li />Search Party 1 - 30 minutes <li />Search Party 2 - 60 minutes [/list] </font> Please choose complete the form below: <form action = 'bounty.php?action=confirm' method = 'post' /> Search Party: <select name = 'searchtype' type = 'dropdown' /> <option value = '1' />Search Party 1</option> <option value = '2' />Search Party 2</option> </select> Search Location: <select name = 'locationnum' type = 'dropdown' /> <option value = '1' />City Centre</option> <option value = '2' />Outskirts</option> <option value = '3' />The Underground</option> </select> <input type = 'submit' value = 'Confirm Details' /> </form>"; } } function confirm() { global $db,$ir,$userid; $cost = 200; //** Cost of entry **// $level = $ir['level']; $entrance = $cost * $level; $time = $_POST['searchtype'] * 30; if($ir['money'] < $entrance) { die("You don't have enough money to join. Go <a href = 'bank.php' />here</a> to get some more."); } elseif(($_POST['searchtype'] == 1) AND ($_POST['locationnum'] == 3)) { die("You can not search the Underground with Search Party 1. Go <a href = 'bounty.php' />back</a> and sign up again."); } else { print "You will be searching with your chosen party for the bounty. <font color = 'red' />You CAN NOT change your details now.</font> Click <a href = 'bounty.php?action=locationsearch' />HERE</a> to begin the search."; $confirm1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `money` = `money` - '%d', `bhlocation` = '%d', `bhparty` = '%d', `searchtime` = '%d' WHERE `userid` = ('%u')", 1, $entrance, $_POST['locationnum'], $_POST['searchtype'], $time, $userid); $db->query($confirm1); } } function location_search() { global $db,$ir,$userid; $chance1 = rand(1,500); //** Change this to set the chance of finding the bounty with Search Party 1 in location 1 **// $bound1a = 400; $bound1b = 415; $chance2 = rand(1,1000); //** Change this to set the chance of finding the bounty with Search Party 1 in location 2 **// $bound2a = 705; $bound2b = 708; $chance3 = rand(1,800); //** Change this to set the chance of finding the bounty with Search Party 2 in location 1 **// $bound3a = 205; $bound3b = 320; $jail = rand(70,140); //** Change this to your preferred jail sentence **// $chance4 = rand(1,1300); //** Change this to set the chance of finding the bounty with Search Party 2 in location 2 **// $bound4a = 500; $bound4b = 680; $hospitalchance = rand(201,270); //** Change this to set the chance of going to hospital **// $hospital = rand(200,330); //** Change this to set the hospital time **// $chance5 = rand(500,4000); //** Change this to set the chance of finding the bounty with Search Party 2 in location 3 **// $bound5a = 600; $bound5b = 1680; $prize2 = 400000000; //** Change this to match your prize choice from the function: index() **// if($ir['bountyhunt'] != 1) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> the bounty hunt before you can search."); } //** Search Party 1 -- Location 1 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: City Centre</h2> You're currently searching in the City Centre with Search Party 1. Visit this page when you've finished searching in {$ir['searchtime']} minutes. <a href = 'index.php' />Home</a>"; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance1 >= $bound1a) AND ($chance1 <= $bound1b)) { print "Congratulations! You and Search Party 1 found the bounty in the City Centre. You receive $t".money_formatter($prize2)." as a reward! However, you have lost 1 life insurance due to the risk of the hunt."; $won1 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($won1); } else { print "Unfortunately you didn't find the bounty in the City Centre. You'll need to <a href = 'bounty.php?action=joinbounty' />join up</a> again if you want to have another look for the bounty."; $lost1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d, `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", 0, 0, 0, 1, $userid); $db->query($lost1); } } //** Search Party 1 -- Location 2 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: Outskirts</h2> You're currently searching in the Outskirts with Search Party 1. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance2 >= $bound2a) AND ($chance2 <= $bound2b)) { print "Congratulations! You and Search Party 1 found the bounty hiding in the outskirts of the city. You receive $t".money_formatter($prize)." as a reward, but your life insurance goes down due to the risk you put yourself through."; $won2 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", $prize, 0, 0, 1, 0, $userid); $db->query($won2); } else { print "Unfortunately you didn't find the bounty in the outskirts. You'll have to <a href = 'bounty.php?action=joinbounty' />join up</a> again to search another time."; $lost2 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost2); } } //** Search Party 2 -- Location 1 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: City Centre</h2> You're currently searching in the City Centre with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance >= $bound3a) AND ($chance <= $bound3b)) { print "Congratulations! You and Search Party 2 found the bounty lurking around the streets of the City Centre. You receive $t".money_formatter($prize2)." as a reward. Your life insurance goes down, however."; $won3 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `bountyhunt` = '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, 0, $userid); $db->query($won3); } else { print "Unfortunately you didn't find the bounty in the City Centre. You also got nicked by the cops for searching through an abandoned building. You go to jail for $jail minutes."; $lost3 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `jail` = '%d', `jail_reason` = 'Got caught searching for the bounty' WHERE `userid` = ('%u')", 0, 0, 0, 1, $jail, $userid); $db->query($lost3); } } //** Search Party 2 -- Location 2 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: Outskirts</h2> You're currently searching in the Outskirts of the city with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance4 >= $bound4a) AND ($chance4 <= $bound4b)) { if($hospitalchance <= $chance4) { print "Congratulations. You successfully caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward, but you also go to hospital with a few major injuries. The bounty put up a big fight as you caught him."; $win4a = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `hospital` = '%d', `hospreason` = 'Was beaten up by the bounty' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $hospital, $userid); $db->query($win4a); } else { print "Congratulations! You and Search Party 2 caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward. Good job!"; $win4b = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win4b); } } else { print "Unfortunately you and Search Party 2 didn't find the bounty anywhere. Better luck next time. <a href = 'bounty.php?action=joinbounty' />Join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } //** Search Party 2 -- Location 3 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: The Underground</h2> You're currently seaching the Underground with Search Party 2. Check this page again when you've finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] == 0)) { if(($chance5 >= $bound5a) AND ($chance5 <= $bound5b)) { print "Congratulations! You and Search Party 2 found and captured the bounty in the Underground of the city. You receive $t".money_formatter($prize2)." as a reward for the bounty's capture."; $win5 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win5); } else { print "Unfortunately you didn't find the bounty. You will have to <a href = 'bounty.php?action=joinbounty' />join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } } $h->endpage(); ?> Make sure to have run the SQL and make sure you've added in the cron. I've tested this and it works on my brothers game, but if there are any errors, please post them here and I will gladly help. :)
-
Re: [mccodes V2] Bounty Hunter Game It works fine for me. You must make sure that you complete all steps when joining. If you don't, you will get a blank screen. As I've said, I'm currently trying to re-do it so it's not a complicated. As for the cron, I'm unsure as to why the AND wouldn't work, as it works perfectly fine for me. :? But at least you got it to work. :) Thank you all for the comments. :)
-
Re: help me plz No probs. :) Glad I could help.
-
Re: help me plz Try this: <?php include "globals.php"; if(!$_GET['spend']) { print "Welcome to the crystal temple! You have [b]{$ir['crystals']}[/b] crystals. What would you like to spend your crystals on? [url='crystaltemple.php?spend=refill']Energy Refill - {$set['ct_refillprice']} Crystals[/url] [url='crystaltemple.php?spend=IQ']IQ - {$set['ct_iqpercrys']} IQ per crystal[/url] [url='crystaltemple.php?spend=money']Money - \${$set['ct_moneypercrys']} per crystal[/url] [url='crystaltemple.php?spend=will']Will Refill - 50 Crystals[/url] [url='crystaltemple.php?spend=brave']Brave Refill - 50 Crystals[/url] "; } else { if($_GET['spend'] == 'refill') { if($ir['crystals'] <$set['ct_refillprice']) { print "You don't have enough crystals!"; } else if($ir['energy'] == $ir['maxenergy']) { print "You already have full energy."; } else { $db->query("UPDATE users SET energy=maxenergy,crystals=crystals-{$set['ct_refillprice']} WHERE userid=$userid"); print "You have paid {$set['ct_refillprice']} crystals to refill your energy bar."; if($_GET['spend'] == 'will') { if($ir['crystals'] < 100) { print "You don't have enough crystals!"; } else if($ir['will'] == $ir['maxwill']) { print "You already have full will."; } else { $db->query("UPDATE users SET will=maxwill,crystals=crystals-100 WHERE userid=$userid"); print "You have paid 100 crystals to refill your will bar."; } } } } else if($_GET['spend'] == 'IQ') { print "Type in the amount of crystals you want to swap for IQ. You have [b]{$ir['crystals']}[/b] crystals. One crystal = {$set['ct_iqpercrys']} IQ.<form action='crystaltemple.php?spend=IQ2' method='post'><input type='text' name='crystals' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'IQ2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough crystals or did not fill out the form. [url='crystaltemple.php?spend=IQ']Back[/url]"; } else { $iqgain=$_POST['crystals']*$set['ct_iqpercrys']; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']} WHERE userid=$userid"); $db->query("UPDATE userstats SET IQ=IQ+$iqgain WHERE userid=$userid"); print "You traded {$_POST['crystals']} crystals for $iqgain IQ."; } } else if($_GET['spend'] == 'money') { print "Type in the amount of crystals you want to swap for money. You have [b]{$ir['crystals']}[/b] crystals. One crystal = \$".number_format($set['ct_moneypercrys']).".<form action='crystaltemple.php?spend=money2' method='post'><input type='text' name='crystals' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'money2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough crystals or did not fill out the form. [url='crystaltemple.php?spend=money']Back[/url]"; } else { $iqgain=$_POST['crystals']*$set['ct_moneypercrys']; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$iqgain WHERE userid=$userid"); print "You traded {$_POST['crystals']} crystals for \$".number_format($iqgain)."."; } } } $h->endpage(); ?> I haven't looked through all of it yet.
-
Re: [mccodes V2] Bounty Hunter Game Are you sure you're completing all of the steps? By the sound of it, you haven't 'chosen' your location properly. Reset all of the fields related to the bounty hunt in the database, then re-try it, making sure you complete all the steps. :) I'm re-doing this so it's easier to work with. I hope to get it to work. :)
-
Re: [mccodes V2] Bounty Hunter Game No problem. :) Glad I could help. I'm currently re-doing it so it's not as complicated. ;)
-
Re: [mccodes V2] Bounty Hunter Game I've just found the little error. Replace function location_search() with this: function location_search() { global $db,$ir,$userid; $chance1 = rand(1,500); //** Change this to set the chance of finding the bounty with Search Party 1 in location 1 **// $bound1a = 400; $bound1b = 415; $chance2 = rand(1,1000); //** Change this to set the chance of finding the bounty with Search Party 1 in location 2 **// $bound2a = 705; $bound2b = 708; $chance3 = rand(1,800); //** Change this to set the chance of finding the bounty with Search Party 2 in location 1 **// $bound3a = 205; $bound3b = 320; $jail = rand(70,140); //** Change this to your preferred jail sentence **// $chance4 = rand(1,1300); //** Change this to set the chance of finding the bounty with Search Party 2 in location 2 **// $bound4a = 500; $bound4b = 680; $hospitalchance = rand(201,270); //** Change this to set the chance of going to hospital **// $hospital = rand(200,330); //** Change this to set the hospital time **// $chance5 = rand(500,4000); //** Change this to set the chance of finding the bounty with Search Party 2 in location 3 **// $bound5a = 600; $bound5b = 1680; $prize2 = 400000000; //** Change this to match your prize choice from the function: index() **// if($ir['bountyhunt'] != 1) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> the bounty hunt before you can search."); } //** Search Party 1 -- Location 1 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: City Centre</h2> You're currently searching in the City Centre with Search Party 1. Visit this page when you've finished searching in {$ir['searchtime']} minutes. <a href = 'index.php' />Home</a>"; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance1 >= $bound1a) AND ($chance1 <= $bound1b)) { print "Congratulations! You and Search Party 1 found the bounty in the City Centre. You receive $t".money_formatter($prize2)." as a reward! However, you have lost 1 life insurance due to the risk of the hunt."; $won1 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, $userid); $db->query($won1); } else { print "Unfortunately you didn't find the bounty in the City Centre. You'll need to <a href = 'bounty.php?action=joinbounty' />join up</a> again if you want to have another look for the bounty."; $lost1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost1); } } //** Search Party 1 -- Location 2 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: Outskirts</h2> You're currently searching in the Outskirts with Search Party 1. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance2 >= $bound2a) AND ($chance2 <= $bound2b)) { print "Congratulations! You and Search Party 1 found the bounty hiding in the outskirts of the city. You receive $t".money_formatter($prize)." as a reward, but your life insurance goes down due to the risk you put yourself through."; $won2 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", $prize, 0, 0, 1, 0, $userid); $db->query($won2); } else { print "Unfortunately you didn't find the bounty in the outskirts. You'll have to <a href = 'bounty.php?action=joinbounty' />join up</a> again to search another time."; $lost2 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost2); } } //** Search Party 2 -- Location 1 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: City Centre</h2> You're currently searching in the City Centre with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance >= $bound3a) AND ($chance <= $bound3b)) { print "Congratulations! You and Search Party 2 found the bounty lurking around the streets of the City Centre. You receive $t".money_formatter($prize2)." as a reward. Your life insurance goes down, however."; $won3 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `bountyhunt` = '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, 0, $userid); $db->query($won3); } else { print "Unfortunately you didn't find the bounty in the City Centre. You also got nicked by the cops for searching through an abandoned building. You go to jail for $jail minutes."; $lost3 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `jail` = '%d', `jail_reason` = 'Got caught searching for the bounty' WHERE `userid` = ('%u')", 0, 0, 0, 1, $jail, $userid); $db->query($lost3); } } //** Search Party 2 -- Location 2 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: Outskirts</h2> You're currently searching in the Outskirts of the city with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance4 >= $bound4a) AND ($chance4 <= $bound4b)) { if($hospitalchance <= $chance4) { print "Congratulations. You successfully caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward, but you also go to hospital with a few major injuries. The bounty put up a big fight as you caught him."; $win4a = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `hospital` = '%d', `hospreason` = 'Was beaten up by the bounty' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $hospital, $userid); $db->query($win4a); } else { print "Congratulations! You and Search Party 2 caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward. Good job!"; $win4b = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win4b); } } else { print "Unfortunately you and Search Party 2 didn't find the bounty anywhere. Better luck next time. <a href = 'bounty.php?action=joinbounty' />Join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } //** Search Party 2 -- Location 3 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: The Underground</h2> You're currently seaching the Underground with Search Party 2. Check this page again when you've finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] == 0)) { if(($chance5 >= $bound5a) AND ($chance5 <= $bound5b)) { print "Congratulations! You and Search Party 2 found and captured the bounty in the Underground of the city. You receive $t".money_formatter($prize2)." as a reward for the bounty's capture."; $win5 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win5); } else { print "Unfortunately you didn't find the bounty. You will have to <a href = 'bounty.php?action=joinbounty' />join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } } $h->endpage(); ?> I missed a ' in one of the queries. :-P
-
Re: [mccodes V2] Bounty Hunter Game There have been some problems with this mod with a few people, so I'm going to re-do a bit of it to make it easier to work with....well, try to. If you would still like to use this one, then by all means do. :) Check this post for updates though. :)
-
Re: [mccodes V2] Bounty Hunter Game Right. Very strange as it's working for me. Could you please PM me. :) :-o I forgot to say, add this to header.php under the function menuarea(): if($ir['bountyhunt'] == 1 AND $ir['searchtime'] > 0) { print "<font color = 'blue' />Searching for the bounty for {$ir['searchtime']} minutes.</font> "; } if($ir['bountyhunt'] == 1 AND $ir['searchtime'] == 0 AND $ir['bhlocation'] > 0) { print "<a href = 'bounty.php?action=locationsearch' /><font color = 'green' />See outcome of Bounty Hunt</font></a> "; } and replace function location_search() with this: function location_search() { global $db,$ir,$userid; $chance1 = rand(1,500); //** Change this to set the chance of finding the bounty with Search Party 1 in location 1 **// $bound1a = 400; $bound1b = 415; $chance2 = rand(1,1000); //** Change this to set the chance of finding the bounty with Search Party 1 in location 2 **// $bound2a = 705; $bound2b = 708; $chance3 = rand(1,800); //** Change this to set the chance of finding the bounty with Search Party 2 in location 1 **// $bound3a = 205; $bound3b = 320; $jail = rand(70,140); //** Change this to your preferred jail sentence **// $chance4 = rand(1,1300); //** Change this to set the chance of finding the bounty with Search Party 2 in location 2 **// $bound4a = 500; $bound4b = 680; $hospitalchance = rand(201,270); //** Change this to set the chance of going to hospital **// $hospital = rand(200,330); //** Change this to set the hospital time **// $chance5 = rand(500,4000); //** Change this to set the chance of finding the bounty with Search Party 2 in location 3 **// $bound5a = 600; $bound5b = 1680; $prize2 = 400000000; //** Change this to match your prize choice from the function: index() **// if($ir['bountyhunt'] != 1) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> the bounty hunt before you can search."); } //** Search Party 1 -- Location 1 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: City Centre</h2> You're currently searching in the City Centre with Search Party 1. Visit this page when you've finished searching in {$ir['searchtime']} minutes. <a href = 'index.php' />Home</a>"; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance1 >= $bound1a) AND ($chance1 <= $bound1b)) { print "Congratulations! You and Search Party 1 found the bounty in the City Centre. You receive $t".money_formatter($prize2)." as a reward! However, you have lost 1 life insurance due to the risk of the hunt."; $won1 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($won1); } else { print "Unfortunately you didn't find the bounty in the City Centre. You'll need to <a href = 'bounty.php?action=joinbounty' />join up</a> again if you want to have another look for the bounty."; $lost1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d, `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", 0, 0, 0, 1, $userid); $db->query($lost1); } } //** Search Party 1 -- Location 2 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: Outskirts</h2> You're currently searching in the Outskirts with Search Party 1. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance2 >= $bound2a) AND ($chance2 <= $bound2b)) { print "Congratulations! You and Search Party 1 found the bounty hiding in the outskirts of the city. You receive $t".money_formatter($prize)." as a reward, but your life insurance goes down due to the risk you put yourself through."; $won2 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", $prize, 0, 0, 1, 0, $userid); $db->query($won2); } else { print "Unfortunately you didn't find the bounty in the outskirts. You'll have to <a href = 'bounty.php?action=joinbounty' />join up</a> again to search another time."; $lost2 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost2); } } //** Search Party 2 -- Location 1 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: City Centre</h2> You're currently searching in the City Centre with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance >= $bound3a) AND ($chance <= $bound3b)) { print "Congratulations! You and Search Party 2 found the bounty lurking around the streets of the City Centre. You receive $t".money_formatter($prize2)." as a reward. Your life insurance goes down, however."; $won3 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `bountyhunt` = '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, 0, $userid); $db->query($won3); } else { print "Unfortunately you didn't find the bounty in the City Centre. You also got nicked by the cops for searching through an abandoned building. You go to jail for $jail minutes."; $lost3 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `jail` = '%d', `jail_reason` = 'Got caught searching for the bounty' WHERE `userid` = ('%u')", 0, 0, 0, 1, $jail, $userid); $db->query($lost3); } } //** Search Party 2 -- Location 2 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: Outskirts</h2> You're currently searching in the Outskirts of the city with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance4 >= $bound4a) AND ($chance4 <= $bound4b)) { if($hospitalchance <= $chance4) { print "Congratulations. You successfully caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward, but you also go to hospital with a few major injuries. The bounty put up a big fight as you caught him."; $win4a = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `hospital` = '%d', `hospreason` = 'Was beaten up by the bounty' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $hospital, $userid); $db->query($win4a); } else { print "Congratulations! You and Search Party 2 caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward. Good job!"; $win4b = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win4b); } } else { print "Unfortunately you and Search Party 2 didn't find the bounty anywhere. Better luck next time. <a href = 'bounty.php?action=joinbounty' />Join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } //** Search Party 2 -- Location 3 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: The Underground</h2> You're currently seaching the Underground with Search Party 2. Check this page again when you've finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] == 0)) { if(($chance5 >= $bound5a) AND ($chance5 <= $bound5b)) { print "Congratulations! You and Search Party 2 found and captured the bounty in the Underground of the city. You receive $t".money_formatter($prize2)." as a reward for the bounty's capture."; $win5 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win5); } else { print "Unfortunately you didn't find the bounty. You will have to <a href = 'bounty.php?action=joinbounty' />join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } } $h->endpage(); ?> I had to edit a few of the queries. :)
-
Re: [mccodes V2] Bounty Hunter Game Thanks. :) Right. I'm not sure why that happened. I'm doing a few more tests as we speak. :) However, I did find one thing wrong, so replace the function location_search() with this: function location_search() { global $db,$ir,$userid; $chance1 = rand(1,500); //** Change this to set the chance of finding the bounty with Search Party 1 in location 1 **// $bound1a = 400; $bound1b = 415; $chance2 = rand(1,1000); //** Change this to set the chance of finding the bounty with Search Party 1 in location 2 **// $bound2a = 705; $bound2b = 708; $chance3 = rand(1,800); //** Change this to set the chance of finding the bounty with Search Party 2 in location 1 **// $bound3a = 205; $bound3b = 320; $jail = rand(70,140); //** Change this to your preferred jail sentence **// $chance4 = rand(1,1300); //** Change this to set the chance of finding the bounty with Search Party 2 in location 2 **// $bound4a = 500; $bound4b = 680; $hospitalchance = rand(201,270); //** Change this to set the chance of going to hospital **// $hospital = rand(200,330); //** Change this to set the hospital time **// $chance5 = rand(500,4000); //** Change this to set the chance of finding the bounty with Search Party 2 in location 3 **// $bound5a = 600; $bound5b = 1680; $prize2 = 400000000; //** Change this to match your prize choice from the function: index() **// if($ir['bountyhunt'] != 1) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> the bounty hunt before you can search."); } //** Search Party 1 -- Location 1 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: City Centre</h2> You're currently searching in the City Centre with Search Party 1. Visit this page when you've finished searching in {$ir['searchtime']} minutes. <a href = 'index.php' />Home</a>"; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance1 >= $bound1a) AND ($chance1 <= $bound1b)) { print "Congratulations! You and Search Party 1 found the bounty in the City Centre. You receive $t".money_formatter($prize2)." as a reward! However, you have lost 1 life insurance due to the risk of the hunt."; $won1 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, $userid); $db->query($won1); } else { print "Unfortunately you didn't find the bounty in the City Centre. You'll need to <a href = 'bounty.php?action=joinbounty' />join up</a> again if you want to have another look for the bounty."; $lost1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", 0, 0, 1, $userid); $db->query($lost1); } } //** Search Party 1 -- Location 2 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: Outskirts</h2> You're currently searching in the Outskirts with Search Party 1. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance2 >= $bound2a) AND ($chance2 <= $bound2b)) { print "Congratulations! You and Search Party 1 found the bounty hiding in the outskirts of the city. You receive $t".money_formatter($prize)." as a reward, but your life insurance goes down due to the risk you put yourself through."; $won2 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", $prize, 0, 0, 1, 0, $userid); $db->query($won2); } else { print "Unfortunately you didn't find the bounty in the outskirts. You'll have to <a href = 'bounty.php?action=joinbounty' />join up</a> again to search another time."; $lost2 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost2); } } //** Search Party 2 -- Location 1 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: City Centre</h2> You're currently searching in the City Centre with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance >= $bound3a) AND ($chance <= $bound3b)) { print "Congratulations! You and Search Party 2 found the bounty lurking around the streets of the City Centre. You receive $t".money_formatter($prize2)." as a reward. Your life insurance goes down, however."; $won3 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `bountyhunt` = '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, 0, $userid); $db->query($won3); } else { print "Unfortunately you didn't find the bounty in the City Centre. You also got nicked by the cops for searching through an abandoned building. You go to jail for $jail minutes."; $lost3 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `jail` = '%d', `jail_reason` = 'Got caught searching for the bounty' WHERE `userid` = ('%u')", 0, 0, 0, 1, $jail, $userid); $db->query($lost3); } } //** Search Party 2 -- Location 2 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: Outskirts</h2> You're currently searching in the Outskirts of the city with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance4 >= $bound4a) AND ($chance4 <= $bound4b)) { if($hospitalchance <= $chance4) { print "Congratulations. You successfully caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward, but you also go to hospital with a few major injuries. The bounty put up a big fight as you caught him."; $win4a = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `hospital` = '%d', `hospreason` = 'Was beaten up by the bounty' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $hospital, $userid); $db->query($win4a); } else { print "Congratulations! You and Search Party 2 caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward. Good job!"; $win4b = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win4b); } } else { print "Unfortunately you and Search Party 2 didn't find the bounty anywhere. Better luck next time. <a href = 'bounty.php?action=joinbounty' />Join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } //** Search Party 2 -- Location 3 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: The Underground</h2> You're currently seaching the Underground with Search Party 2. Check this page again when you've finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] == 0)) { if(($chance5 >= $bound5a) AND ($chance5 <= $bound5b)) { print "Congratulations! You and Search Party 2 found and captured the bounty in the Underground of the city. You receive $t".money_formatter($prize2)." as a reward for the bounty's capture."; $win5 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win5); } else { print "Unfortunately you didn't find the bounty. You will have to <a href = 'bounty.php?action=joinbounty' />join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } } $h->endpage(); ?> Which search party and location did you choose?
-
Re: [mccodes V2] Bounty Hunter Game The cron works fine for me. You may have an issue with your cron_minute. Thank you all for the comments. And just for clarification, SoldierB is the user from my brother's game who gave me this idea, but I developed it a little from his original idea. :) At the moment, the user joins a group, but not with any other user. Then, if they find the bounty, they get the prize. So, any use can win. :) However, I may develop this some more and add in a few extras, then possibly sell it, if it's worth selling. As I'm not much good with business as such, I'd need a few opinions on whether or not a developed version of this would be worth selling.
-
Re: [mccodes V2] Bounty Hunter Game No problem. And thank you. :)
-
Re: [mccodes V2] Bounty Hunter Game In the index() function, change the $prize = $400; to $prize = X, replacing X with what you want. Then, in function location_search(), change the $prize2 = 400000000; to match what you did with the index() function. :)
-
Re: [mccodes V2] Bounty Hunter Game Thank you all for the comments. :) I forgot to mention (as I had to remove a bit of text to fit everything in), I coded this from scratch. I got the idea from a user on my brother's game. :)
-
Re: [mccodes V2] Bounty Hunter Game (cont'd from last post) Paste the remaining code into the file: function location_search() { global $db,$ir,$userid; $chance1 = rand(1,500); //** Change this to set the chance of finding the bounty with Search Party 1 in location 1 **// $bound1a = 400; $bound1b = 415; $chance2 = rand(1,1000); //** Change this to set the chance of finding the bounty with Search Party 1 in location 2 **// $bound2a = 705; $bound2b = 708; $chance3 = rand(1,800); //** Change this to set the chance of finding the bounty with Search Party 2 in location 1 **// $bound3a = 205; $bound3b = 320; $jail = rand(70,140); //** Change this to your preferred jail sentence **// $chance4 = rand(1,1300); //** Change this to set the chance of finding the bounty with Search Party 2 in location 2 **// $bound4a = 500; $bound4b = 680; $hospitalchance = rand(201,270); //** Change this to set the chance of going to hospital **// $hospital = rand(200,330); //** Change this to set the hospital time **// $chance5 = rand(500,4000); //** Change this to set the chance of finding the bounty with Search Party 2 in location 3 **// $bound5a = 600; $bound5b = 1680; $prize2 = 400000000; //** Change this to match your prize choice from the function: index() **// if($ir['bountyhunt'] != 1) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> the bounty hunt before you can search."); } //** Search Party 1 -- Location 1 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: City Centre</h2> You're currently searching in the City Centre with Search Party 1. Visit this page when you've finished searching in {$ir['searchtime']} minutes. <a href = 'index.php' />Home</a>"; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] == 0)) { if(($chance1 >= $bound1a) AND ($chance1 <= $bound1b)) { print "Congratulations! You and Search Party 1 found the bounty in the City Centre. You receive $t".money_formatter($prize2)." as a reward! However, you have lost 1 life insurance due to the risk of the hunt."; $won1 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, $userid); $db->query($won1); } else { print "Unfortunately you didn't find the bounty in the City Centre. You'll need to <a href = 'bounty.php?action=joinbounty' />join up</a> again if you want to have another look for the bounty."; $lost1 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", 0, 0, 1, $userid); $db->query($lost1); } } //** Search Party 1 -- Location 2 **// elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 1: Outskirts</h2> You're currently searching in the Outskirts with Search Party 1. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 1) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance2 >= $bound2a) AND ($chance2 <= $bound2b)) { print "Congratulations! You and Search Party 1 found the bounty hiding in the outskirts of the city. You receive $t".money_formatter($prize)." as a reward, but your life insurance goes down due to the risk you put yourself through."; $won2 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bountyhunt` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", $prize, 0, 0, 1, 0, $userid); $db->query($won2); } else { print "Unfortunately you didn't find the bounty in the outskirts. You'll have to <a href = 'bounty.php?action=joinbounty' />join up</a> again to search another time."; $lost2 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost2); } } //** Search Party 2 -- Location 1 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 1) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: City Centre</h2> You're currently searching in the City Centre with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance >= $bound3a) AND ($chance <= $bound3b)) { print "Congratulations! You and Search Party 2 found the bounty lurking around the streets of the City Centre. You receive $t".money_formatter($prize2)." as a reward. Your life insurance goes down, however."; $won3 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `bountyhunt` = '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 1, 0, $userid); $db->query($won3); } else { print "Unfortunately you didn't find the bounty in the City Centre. You also got nicked by the cops for searching through an abandoned building. You go to jail for $jail minutes."; $lost3 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `jail` = '%d', `jail_reason` = 'Got caught searching for the bounty' WHERE `userid` = ('%u')", 0, 0, 0, 1, $jail, $userid); $db->query($lost3); } } //** Search Party 2 -- Location 2 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: Outskirts</h2> You're currently searching in the Outskirts of the city with Search Party 2. Check this page again when you have finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 2) AND ($ir['searchtime'] == 0)) { if(($chance4 >= $bound4a) AND ($chance4 <= $bound4b)) { if($hospitalchance <= $chance4) { print "Congratulations. You successfully caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward, but you also go to hospital with a few major injuries. The bounty put up a big fight as you caught him."; $win4a = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d', `hospital` = '%d', `hospreason` = 'Was beaten up by the bounty' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $hospital, $userid); $db->query($win4a); } else { print "Congratulations! You and Search Party 2 caught the bounty in the Outskirts of the city. You receive $t".money_formatter($prize2)." as a reward. Good job!"; $win4b = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win4b); } } else { print "Unfortunately you and Search Party 2 didn't find the bounty anywhere. Better luck next time. <a href = 'bounty.php?action=joinbounty' />Join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } //** Search Party 2 -- Location 3 **// elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] > 0)) { print "<h2 />Search Party 2: The Underground</h2> You're currently seaching the Underground with Search Party 2. Check this page again when you've finished searching in {$ir['searchtime']} minutes."; } elseif(($ir['bhparty'] == 2) AND ($ir['bhlocation'] == 3) AND ($ir['searchtime'] == 0)) { if(($chance5 >= $bound5a) AND ($chance5 <= $bound5b)) { print "Congratulations! You and Search Party 2 found and captured the bounty in the Underground of the city. You receive $t".money_formatter($prize2)." as a reward for the bounty's capture."; $win5 = sprintf("UPDATE `users` SET `money` = `money` + '%d', `bountyhunt` = '%d', `bhparty` = '%d', `bhlocation` = '%d', `lifeins` = `lifeins` - '%d' WHERE `userid` = ('%u')", $prize2, 0, 0, 0, 1, $userid); $db->query($win5); } else { print "Unfortunately you didn't find the bounty. You will have to <a href = 'bounty.php?action=joinbounty' />join up</a> to search again."; $lost4 = sprintf("UPDATE `users` SET `bountyhunt` = '%d', `bhparty` = '%d', `lifeins` = `lifeins` - '%d', `bhlocation` = '%d' WHERE `userid` = ('%u')", 0, 0, 1, 0, $userid); $db->query($lost4); } } } $h->endpage(); ?> I hope you all enjoy this mod. I am open to all comments. If you find any errors, please post. Also, if you use this mod, please post as well. :) Thank you.
-
Re: [mccodes V2] Bounty Hunter Game (cont'd from last post) Create a file called bounty.php and paste this in it: <?php include "globals.php"; if($ir['hospital'] OR $ir['jail']) { die("<font color = 'red' /><b />You can't access this page when in Hospital or Jail.[/b]</font>"); } switch($_GET['action']) { case 'lifeinsurance': life_insurance(); break; case 'lifeinssubmit': lifeins_submit(); break; case 'joinbounty': join_bounty(); break; case 'joinbountysubmit': joinbounty_submit(); break; case 'searchbounty': search_bounty(); break; case 'searching': searching(); break; case 'confirm': confirm(); break; case 'locationsearch': location_search(); break; default: index(); break; } function index() { global $db,$ir,$userid; $prize = '?400'; //** Change the text to your prize if the user finds the bounty **// if($ir['bountyhunt'] == 1) { print "You're already in the bounty hunt. <a href = 'bounty.php?action=searchbounty' />Click Here</a> to continue."; } else { print "<h2 />The $prize Million Bounty</h2> Welcome to the Bounty Hunter game. Here, you can join in the bounty hunt for a criminal. You will be able to search in three different locations. If you find and successfully capture the criminal, you will get $prize million. However, you will have to buy some <a href = 'bounty.php?action=lifeinsurance' />life insurance</a> before you join. Click below to join the hunt: <form action = 'bounty.php?action=joinbounty' method = 'post' /> <input type = 'submit' value = 'Join Hunt' /> </form>"; } } function life_insurance() { global $db,$ir,$userid; $_POST['lins'] = abs((int) $_POST['lins']); $price = ($ir['level'] * 850); //** Change this formula to the price you want for life insurance **// $getins = $_POST['lins']; $insurance = $price * $getins; print "<h2 />Getting Life Insurance</h2> Welcome. To get life insurance, it will cost you $t".money_formatter($price)." times the amount of life insurance you buy. <font color = 'yellow' />You currently have {$ir['lifeins']} life insurance.</font> Fill in the form below to get life insurance. <form action = 'bounty.php?action=lifeinssubmit' method = 'post' /> <input type = 'text' name = 'lins' value = '1' /> <input type = 'submit' value = 'Get life insurance' /> </form> or click <a href = 'bounty.php' />here</a> to go back."; } function lifeins_submit() { global $db,$ir,$userid; $_POST['lins'] = abs((int) $_POST['lins']); $price = ($ir['level'] * 850); //** Change this formula to the price you want for life insurance **// $getins = $_POST['lins']; $insurance = $price * $getins; $LIlimit = 15; //** Change this to the max amount of life insurance a user can buy at one time **// print "<h2 />Paying for Life Insurance</h2> "; if($ir['money'] < $insurance) { die("Sorry. You don't have enough money to get life insurance. Please come back later."); } elseif($_POST['lins'] > $LIlimit) { die("You can not buy more than $LIlimit life insurance at once."); } else { print "You've now got life insurance. If you get injured or come back to join another bounty hunt, life insurance may be more expensive. <a href = 'bounty.php' />Return to bounty hunt</a>."; $lifeinssql = sprintf("UPDATE `users` SET `money` = `money` - '%d', `lifeins` = `lifeins` + '%d' WHERE `userid` = ('%u')", $insurance, $_POST['lins'], $userid); $db->query($lifeinssql); } } function join_bounty() { global $db,$ir,$userid; $cost = 200; //** Change this to the entrance fee you want **// $level = ($ir['level']); $entrance = $level * $cost; if($ir['lifeins'] == 0) { die("Sorry. You need some <a href = 'bounty.php?action=lifeinsurance' />life insurance</a> before you can join the bounty hunt."); } elseif($ir['bountyhunt'] == 1) { die("You're already in the bounty hunt! Either <a href = 'bounty.php?action=searchbounty' />choose a search party</a> or <a href = 'bounty.php?action=searching' />choose a location to search</a>."); } else { print "<h2 />The Bounty Hunt</h2> Welcome to the Bounty Hunt. Here, you can submit your name to the bounty hunt list. It will cost you $t".money_formatter($entrance)." to submit your name. Would you like to add your name to the list? <form action = 'bounty.php?action=joinbountysubmit' method = 'post' /> <input type = 'submit' value = 'Yes, submit name' /> </form> <form action = 'index.php' method = 'post' /> <input type = 'submit' value = 'No Thanks' /> </form>"; } } function joinbounty_submit() { global $db,$ir,$userid; $cost = 200; //** Change this to the entrance fee you want **// $level = ($ir['level']); $entrance = $level * $cost; if($ir['money'] < $entrance) { die("Sorry. You do not have enough money to submit your name."); } elseif($ir['lifeins'] == 0) { die("Sorry. You need <a href = 'bounty.php?action=lifeinsurance' />life insurance</a> before you can submit your name."); } elseif($ir['bountyhunt'] == 1) { die("You're already in the bounty hunt! Either <a href = 'bounty.php?action=searchbounty' />choose a search party</a> or <a href = 'bounty.php?action=searching' />choose a location to search</a>."); } else { print "<h2 />Joining the Bounty Hunt</h2> Now that you have joined the bounty hunt, you can not do anything else until you've searched around a bit for the bounty. Click below to enter a search party. <form action = 'bounty.php?action=searchbounty' method = 'post' /> <input type = 'submit' value = 'Select a Search Party' /> </form>"; $joinsubmit = sprintf("UPDATE `users` SET `money` = `money` - '%d', `bountyhunt` = '%d' WHERE `userid` = ('%u')", $entrance, 1, $userid); $db->query($joinsubmit); } } function search_bounty() { global $db,$ir,$userid; if($ir['bountyhunt'] == 0) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> the bounty hunt before you can participate in the hunt."); } elseif($ir['bhparty'] > 0) { die("You're already with a search party. <a href = 'bounty.php?action=confirm' />Confirm</a> your details to make sure you have everything chosen."); } else { print "<h2 />Search Parties</h2> Now's the time to select your search party. You have 2 to choose from: <font color = 'blue' /> <ul /> <li />Search Party 1 - 30 minutes <li />Search Party 2 - 80 minutes [/list] </font> After choosing your party, click on Start Searching. You will search for the assigned time for the party that you chose to join. <form action = 'bounty.php?action=searching' method = 'post' /> <select name = 'searchtype' type = 'dropdown' /> <option value = '1' />Search Party 1</option> <option value = '2' />Search Party 2</option> </select> <input type = 'submit' value = 'Start Searching' /> </form>"; } } function searching() { global $db,$ir,$userid; if($ir['bountyhunt'] == 0) { die("Sorry. You need to <a href = 'bounty.php?action=joinbounty.php' />join</a> the bounty hunt before you can go searching."); } elseif($ir['bhlocation'] > 0) { die("You've already confirmed your details. <a href = 'bounty.php?action=locationsearch' />Start Searching</a>."); } elseif($_POST['searchtype'] == 1) { print "<h2 />Search Party 1</h2> You have chosen to join Search Party 1. We will be searching for the bounty for 30 minutes. For this time, you won't be able to do anything else. Please choose where you want to search: <form action = 'bounty.php?action=confirm' method = 'post' /> <select name = 'locationnum' type = 'dropdown' /> <option value = '1' />City Centre</option> <option value = '2' />Outskirts</option> </select> <input type = 'submit' value = 'Search Area' /> </form>"; $sp1 = sprintf("UPDATE `users` SET `searchtime` = '%d', `bhparty` = '%d' WHERE `userid` = ('%u')", 30, 1, $userid); $db->query($sp1); } elseif($_POST['searchtype'] == 2) { print "<h2 />Search Party 2</h2> You have chosen to join Search Party 2. We will be searching for the bounty for 80 minutes. For this time, you won't be able to do anything else. Now to choose where you want to search: <form action = 'bounty.php?action=confirm' method = 'post' /> <select name = 'locationnum' type = 'dropdown' /> <option value = '1' />City Centre</option> <option value = '2' />Outskirts</option> <option value = '3' />The Underground</option> </select> <input type = 'submit' value = 'Search Area' /> </form>"; $sp2 = sprintf("UPDATE `users` SET `searchtime` = '%d', `bhparty` = '%d' WHERE `userid` = ('%u')", 80, 2, $userid); $db->query($sp2); } } function confirm() //** This function is here to make the final searching easier to do **// { global $db,$ir,$userid; if($ir['bountyhunt'] != 1) { die("You need to <a href = 'bounty.php?action=joinbounty' />join</a> first."); } elseif($ir['bhparty'] == 0) { die("You haven't chosen a search party. <a href = 'bounty.php?action=searchbounty' />Go back</a> to the beginning and double check everything."); } elseif($_POST['locationnum'] == 1) { print "<h2 />Confirming Details</h2> You will be searching for the bounty with Search Party {$ir['bhparty']}. Good luck! Click <a href = 'bounty.php?action=locationsearch' />HERE</a> to begin the search!"; $query = sprintf("UPDATE `users` SET `bhlocation` = '%d' WHERE `userid` = ('%u')", 1, $userid); $db->query($query); } elseif($_POST['locationnum'] == 2) { print "<h2 />Confirming Details</h2> You will be searching for the bounty with Search Party {$ir['bhparty']}. Good luck! Click <a href = 'bounty.php?action=locationsearch' />HERE</a> to begin the search!"; $query2 = sprintf("UPDATE `users` SET `bhlocation` = '%d' WHERE `userid` = ('%u')", 2, $userid); $db->query($query2); } elseif($_POST['locationnum'] == 3) { print "<h2 />Confirming Details</h2> You will be searching for the bounty with Search Party {$ir['bhparty']}. Good luck! Click <a href = 'bounty.php?action=locationsearch' />HERE</a> to begin the search!"; $query3 = sprintf("UPDATE `users` SET `bhlocation` = '%d' WHERE `userid` = ('%u')", 3, $userid); $db->query($query3); } else { print "You may have confirmed your details already. If so, please click <a href = 'bounty.php?action=locationsearch' />HERE</a> to continue. If you haven't selected your location yet, click <a href = 'bounty.php?action=searching' />HERE</a>."; } } (code cont'd next post)
-
Hi all! I've been developing this mod for two days and have finally finished it. :) Name: Bounty Hunter Description: The user win a large sum of money (depending on how you set you) if they join the bounty hunt. However, before they can join, they must buy life insurance. This comes at a costly price, but again, is easily changeable. Once they buy life insurance, they can then join the hunt. They can choose to join one of two search parties: Search Party 1 or Search Party 2. Once chosen, the user must then choose the location they want to search in. After choosing the location, they must confirm their choices. Once confirmed, they can start the search. Search Party 1 will take 30 minutes to complete the search and Search Party 2 will take 80 minutes to complete the search. Therefore, there is a higher chance of finding the bounty if they user joins Search Party 2, as the search is longer. All chance formulas and outcomes can easily be changed. I have included comments to help. :) Installation! Step 1: Run this SQL in PHPMyAdmin: ALTER TABLE `users` ADD `bountyhunt` INT(11) NOT NULL DEFAULT '0', ADD `bhparty` INT(11) NOT NULL DEFAULT '0', ADD `bhlocation` INT(11) NOT NULL DEFAULT '0', ADD `searchtime` INT(11) NOT NULL DEFAULT '0', ADD `lifeins` INT(11) NOT NULL DEFAULT '0'; Step 2: Add this cron into cron_minute.php: $db->query("UPDATE users SET searchtime = searchtime - 1 WHERE searchtime > 0 AND bhlocation > 0"); Step 3: Then create a file called bountyglobals.php and paste this in it: <?php if($ir['bountyhunt'] > 0) { die("<font color = 'red' /><b /><center />You are currently involved with a bounty hunt. You won't be able to access this page until you finish the hunt in {$ir['searchtime']} minutes.</center>[/b]</font>"); } ?> Add include "bountyglobals.php"; at the top of every page that you do not want the user to access when in a bounty hunt. Step 4: Then put this link somewhere in explore.php: <a href = 'bounty.php' />Bounty Hunter</a> (cont'd next post)