Jump to content
MakeWebGames

-BRAIDZ-

Members
  • Posts

    403
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by -BRAIDZ-

  1. If you want to mate, go for it
  2. brewery.php <?php require_once("globals.php"); if ($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } if ($ir['brew_time']) { die("You can't brew for another {$ir['brew_time']} minutes, when your current batch finishes."); } if ($ir['brew'] == 15) { echo 'You have already brewed 15 times today, come back tomorrow'; $h->endpage(); die; } $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : ''; switch ($_GET['action']) { case 'beer': brew_beer(); break; case 'drinkbeer': drink_beer(); break; case 'brewbeer': brew_beer_sub(); break; case 'whiskey': brew_whiskey(); break; case 'cider': brew_cider(); break; case 'brewcider': brew_cider_sub(); break; case 'brewwhiskey': brew_whiskey_sub(); break; case 'collectbeer': collect_beer(); break; case 'beercollected': beer_collected(); break; case 'collectwhiskey': collect_whiskey(); break; case 'collectcider': collect_cider(); break; case 'whiskeycollected': whiskey_collected(); break; case 'cidercollected': cider_collected(); break; case 'drinkwhiskey': drink_whiskey(); break; case 'drinkcider': drink_cider(); break; case 'vodka': brew_vodka(); break; case 'brewvodka': brew_vodka_sub(); break; case 'collectvodka': collect_vodka(); break; case 'vodkacollected': vodka_collected(); break; case 'drinkvodka': drink_vodka(); break; default: brewery(); break; } function brewery() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table> <h3>Your Brewery</h3>"; echo " You can brew alcohol 15 times a day. </br>What would you like to brew?</br>"; echo " <br> <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'>Brewery Options</th> </tr> <tr> <td>Beer</td> <td> <a href='brewery.php?action=beer'>Brew</a> </td> </tr> <tr> <td>Whiskey</td> <td> <a href='brewery.php?action=whiskey'>Brew</a> </td> </tr> </tr> <tr> <td>Cider</td> <td> <a href='brewery.php?action=cider'>Brew</a> </td> </tr> </tr> <tr> <td>Vodka</td> <td> <a href='brewery.php?action=vodka'>Brew</a> </td> </tr> </table> </br> "; echo " <br> <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'>Collection of Alcohol</th> </tr> <tr> <td>Beer</td> <td> <a href='brewery.php?action=collectbeer'>Collect</a> </td> </tr> <tr> <td>Whiskey</td> <td> <a href='brewery.php?action=collectwhiskey'>Collect</a> </td> </tr> </tr> <tr> <td>Cider</td> <td> <a href='brewery.php?action=collectcider'>Collect</a> </td> </tr> </tr> <tr> <td>Vodka</td> <td> <a href='brewery.php?action=collectvodka'>Collect</a> </td> </tr> </table> </br> "; echo " <br> <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'>Alcohol Ready For Collection</th> </tr> <tr> <td>Beer</td> <td><font color ='green'>" . number_format($ir["brewed_beer"]) . " Bottles</font></td> </tr> <tr> <td>Whiskey</td> <td><font color ='green'>" . number_format($ir["brewed_whiskey"]) . " Bottles</font></td> </tr> </tr> <tr> <td>Cider</td> <td><font color ='green'>" . number_format($ir["brewed_cider"]) . " Bottles</font></td> </tr> </tr> <tr> <td>Vodka</td> <td><font color ='green'>" . number_format($ir["brewed_vodka"]) . " Bottles</font></td> </tr> </table> </br> "; } function brew_beer() { print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Beer</h3>"; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'> Beer Information</th> </tr> <tr> <td>Time to brew Beer?</td> <td>6 Minutes</td> </tr> <tr> <td>Cost to brew Beer?</td> <td>$25,000</td> </tr> <td>What does Beer do?</td> <td>Gives you a random amount of energy</td> </tr> </table> <form method='post' action='brewery.php?action=brewbeer'> <input type='submit' name='brewbeer' value='Brew Beer' /> </form> "; } function brew_whiskey() { print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Whiskey</h3>"; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'> Whiskey Information</th> </tr> <tr> <td>Time to brew Whiskey?</td> <td>10 Minutes</td> </tr> <tr> <td>Cost to brew Whiskey?</td> <td>$50,000</td> </tr> <td>What does Whiskey do?</td> <td>Gives you a random amount of brave</td> </tr> </table> <form method='post' action='brewery.php?action=brewwhiskey'> <input type='submit' name='brewwhiskey' value='Brew Whiskey' /> </form> "; } function brew_beer_sub() { global $db, $ir, $c, $userid, $h, $beer; if ($ir['money'] <= 25000) { echo "You don't have enough Money"; $h->endpage(); die; } else { if ($_POST['brewbeer']) { $beer = rand(1, 6); echo "You only had enough ingredients to brew, {$beer} Bottle(s) of Beer!</br> Come back in 6 minutes to collect your beer"; $db->query("UPDATE users SET brew=brew + 1 WHERE userid=$userid"); $db->query("UPDATE users SET brewed_beer=brewed_beer + $beer WHERE userid=$userid"); $db->query("UPDATE users SET money=money - 25000 WHERE userid=$userid"); $db->query("UPDATE users SET brew_time=brew_time + 6 WHERE userid=$userid"); if ($ir['brew_time'] == 0) { } } } } function drink_beer() { global $db, $ir, $c, $userid, $h; $query = $db->query("SELECT `inv_qty` FROM inventory WHERE inv_userid = {$userid} AND `inv_itemid` = 277"); $itemid = $db->num_rows($query); if (!$db->num_rows($query)) { echo "You don't have enough beer"; die; } else { $eng = rand(5, 20); echo "You drank 1 Bottle of Beer, you gained {$eng} energy"; $db->query("UPDATE users SET energy=energy + $eng WHERE userid=$userid"); item_remove($userid, 277, 1); } } function collect_beer() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Collect Beer</h3>"; echo "You have " . number_format($ir["brewed_beer"]) . " Bottles of Beer, how many would you like to collect?"; echo "<form method='post' action='brewery.php?action=beercollected'> <input style='background: white;' type='text' name='amount' maxlength='10' placeholder='amount' required /> </br><input type='submit' name='beercollected' value='Collect' /> </form>"; } function beer_collected() { global $db, $ir, $c, $userid, $h, $_POST; $ir['brewed_beer'] = abs((int) $ir['brewed_beer']); if ($_POST['amount'] > $ir['brewed_beer']) { echo "You don't have this much beer you only have " . number_format($ir["brewed_beer"]) . " Bottles of Beer"; $h->endpage(); die; } else { global $db, $ir, $c, $userid, $h, $_POST; $_POST['amount'] = isset($_POST['amount']) && ctype_digit($_POST['amount']) ? abs(intval($_POST['amount'])) : 0; $db->query("UPDATE users SET brewed_beer=brewed_beer - {$_POST['amount']} WHERE userid=$userid"); item_add($userid, 277, ($_POST['amount'])); echo "You have collected " . number_format($_POST["amount"]) . " Bottles of Beer, you have " . number_format($ir["brewed_beer"]) . " left"; } } function brew_whiskey_sub() { global $db, $ir, $c, $userid, $h, $whiskey; if ($ir['money'] <= 50000) { echo "You don't have enough Money"; $h->endpage(); die; } else { if ($_POST['brewwhiskey']) { $whiskey = rand(1, 9); echo "You only had enough ingredients to brew, {$whiskey} Bottle(s) of Whiskey!</br> Come back in 10 minutes to collect your Whiskey"; $db->query("UPDATE users SET brew=brew + 1 WHERE userid=$userid"); $db->query("UPDATE users SET brewed_whiskey=brewed_whiskey + $whiskey WHERE userid=$userid"); $db->query("UPDATE users SET money=money - 50000 WHERE userid=$userid"); $db->query("UPDATE users SET brew_time=brew_time + 10 WHERE userid=$userid"); if ($ir['brew_time'] == 0) { } } } } function collect_whiskey() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Collect Whiskey</h3>"; echo "You have " . number_format($ir["brewed_whiskey"]) . " Bottles of Whiskey, how many would you like to collect?"; echo "<form method='post' action='brewery.php?action=whiskeycollected'> <input style='background: white;' type='text' name='amount' maxlength='10' placeholder='amount' required /> </br><input type='submit' name='whiskeycollected' value='Collect' /> </form>"; } function whiskey_collected() { global $db, $ir, $c, $userid, $h, $_POST; $ir['brewed_whiskey'] = abs((int) $ir['brewed_whiskey']); if ($_POST['amount'] > $ir['brewed_whiskey']) { echo "You don't have this much whiskey you only have " . number_format($ir["brewed_whiskey"]) . " Bottles of Whiskey"; $h->endpage(); die; } else { global $db, $ir, $c, $userid, $h, $_POST; $_POST['amount'] = isset($_POST['amount']) && ctype_digit($_POST['amount']) ? abs(intval($_POST['amount'])) : 0; $db->query("UPDATE users SET brewed_whiskey=brewed_whiskey - {$_POST['amount']} WHERE userid=$userid"); item_add($userid, 278, ($_POST['amount'])); echo "You have collected " . number_format($_POST["amount"]) . " Bottle(s) of Whiskey, you have " . number_format($ir["brewed_whiskey"]) . " left"; } } function drink_whiskey() { global $db, $ir, $c, $userid, $h; $query = $db->query("SELECT `inv_qty` FROM inventory WHERE inv_userid = {$userid} AND `inv_itemid` = 278"); $itemid = $db->num_rows($query); if (!$db->num_rows($query)) { echo "You don't have enough whiskey"; die; } else { $brv = rand(2, 25); echo "You drank 1 Bottle of Whiskey, you gained {$brv} brave"; $db->query("UPDATE users SET brave=brave + $brv WHERE userid=$userid"); item_remove($userid, 278, 1); } } function brew_cider() { print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Cider</h3>"; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'> Cider Information</th> </tr> <tr> <td>Time to brew Cider?</td> <td>10 Minutes</td> </tr> <tr> <td>Cost to brew Cider?</td> <td>$75,000</td> </tr> <td>What does Cider do?</td> <td>Gives you a random amount of will</td> </tr> </table> <form method='post' action='brewery.php?action=brewcider'> <input type='submit' name='brewcider' value='Brew Cider' /> </form> "; } function brew_cider_sub() { global $db, $ir, $c, $userid, $h, $cider; if ($ir['money'] <= 75000) { echo "You don't have enough Brave"; $h->endpage(); die; } else { if ($_POST['brewcider']) { $cider = rand(1, 9); echo "You only had enough ingredients to brew, {$cider} Bottle(s) of Cider!</br> Come back in 13 minutes to collect your cider"; $db->query("UPDATE users SET brew=brew + 1 WHERE userid=$userid"); $db->query("UPDATE users SET brewed_cider=brewed_cider + $cider WHERE userid=$userid"); $db->query("UPDATE users SET money=money - 75000 WHERE userid=$userid"); $db->query("UPDATE users SET brew_time=brew_time + 13 WHERE userid=$userid"); if ($ir['brew_time'] == 0) { } } } } function collect_cider() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Collect Cider</h3>"; echo "You have " . number_format($ir["brewed_cider"]) . " Bottles of Cider, how many would you like to collect?"; echo "<form method='post' action='brewery.php?action=cidercollected'> <input style='background: white;' type='text' name='amount' maxlength='10' placeholder='amount' required /> </br><input type='submit' name='cidercollected' value='Collect' /> </form>"; } function cider_collected() { global $db, $ir, $c, $userid, $h, $_POST; $ir['brewed_cider'] = abs((int) $ir['brewed_cider']); if ($_POST['amount'] > $ir['brewed_cider']) { echo "You don't have this much beer you only have " . number_format($ir["brewed_cider"]) . " Bottles of Cider"; $h->endpage(); die; } else { global $db, $ir, $c, $userid, $h, $_POST; $_POST['amount'] = isset($_POST['amount']) && ctype_digit($_POST['amount']) ? abs(intval($_POST['amount'])) : 0; $db->query("UPDATE users SET brewed_cider=brewed_cider - {$_POST['amount']} WHERE userid=$userid"); item_add($userid, 279, ($_POST['amount'])); echo "You have collected " . number_format($_POST["amount"]) . " Bottles of Cider, you have " . number_format($ir["brewed_cider"]) . " left"; } } function drink_cider() { global $db, $ir, $c, $userid, $h; $query = $db->query("SELECT `inv_qty` FROM inventory WHERE inv_userid = {$userid} AND `inv_itemid` = 279"); $itemid = $db->num_rows($query); if (!$db->num_rows($query)) { echo "You don't have enough Cider"; die; } else { $will = rand(100, 1250); echo "You drank 1 Bottle of Cider, you gained {$will} will"; $db->query("UPDATE users SET will=will + $will WHERE userid=$userid"); item_remove($userid, 279, 1); } } function brew_vodka() { print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Vodka</h3>"; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'>Vodka Information</th> </tr> <tr> <td>Time to brew Vodka?</td> <td>15 Minutes</td> </tr> <tr> <td>Cost to brew Vodka</td> <td>$100,000</td> </tr> <td>What does Vodka do?</td> <td>Will give you a random amount of strength</td> </tr> </table> <form method='post' action='brewery.php?action=brewvodka'> <input type='submit' name='brewvodka' value='Brew Vodka' /> </form> "; } function brew_vodka_sub() { global $db, $ir, $c, $userid, $h, $vod; if ($ir['money'] <= 100000) { echo "You don't have enough Money"; $h->endpage(); die; } else { if ($_POST['brewvodka']) { $vod = rand(2, 9); echo "You only had enough ingredients to brew, {$vod} Bottle(s) of Vodka!</br> Come back in 15 minutes to collect your vodka"; $db->query("UPDATE users SET brew=brew + 1 WHERE userid=$userid"); $db->query("UPDATE users SET brewed_vodka=brewed_vodka + $vod WHERE userid=$userid"); $db->query("UPDATE users SET money=money - 100000 WHERE userid=$userid"); $db->query("UPDATE users SET brew_time=brew_time + 15 WHERE userid=$userid"); if ($ir['brew_time'] == 0) { } } } } function collect_vodka() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Collect Vodka</h3>"; echo "You have " . number_format($ir["brewed_vodka"]) . " Bottles of Vodka, how many would you like to collect?"; echo "<form method='post' action='brewery.php?action=vodkacollected'> <input style='background: white;' type='text' name='amount' maxlength='10' placeholder='amount' required /> </br><input type='submit' name='vodkacollected' value='Collect' /> </form>"; } function vodka_collected() { global $db, $ir, $c, $userid, $h, $_POST; $ir['brewed_vodka'] = abs((int) $ir['brewed_vodka']); if ($_POST['amount'] > $ir['brewed_vodka']) { echo "You don't have this much vodka you only have " . number_format($ir["brewed_vodka"]) . " Bottles of Vodka"; $h->endpage(); die; } else { global $db, $ir, $c, $userid, $h, $_POST; $_POST['amount'] = isset($_POST['amount']) && ctype_digit($_POST['amount']) ? abs(intval($_POST['amount'])) : 0; $db->query("UPDATE users SET brewed_vodka=brewed_vodka - {$_POST['amount']} WHERE userid=$userid"); item_add($userid, 280, ($_POST['amount'])); echo "You have collected " . number_format($_POST["amount"]) . " Bottles of Vodka, you have " . number_format($ir["brewed_vodka"]) . " left"; } } function drink_vodka() { global $db, $ir, $c, $userid, $h; $query = $db->query("SELECT `inv_qty` FROM inventory WHERE inv_userid = {$userid} AND `inv_itemid` = 280"); $itemid = $db->num_rows($query); if (!$db->num_rows($query)) { echo "You don't have enough Vodka"; die; } else { $str = rand(150, 2050); echo "You drank 1 Bottle of Vodka, you gained {$str} strength"; $db->query("UPDATE userstats SET strength=strength + $str WHERE userid=$userid"); item_remove($userid, 280, 1); } } ?>   Sql: ALTER TABLE users ADD brew BIGINT(25) NOT NULL DEFAULT 0; ALTER TABLE users ADD brew_time BIGINT(25) NOT NULL DEFAULT 0; ALTER TABLE users ADD brewed_beer BIGINT(25) NOT NULL DEFAULT 0; ALTER TABLE users ADD brewed_whiskey BIGINT(25) NOT NULL DEFAULT 0; ALTER TABLE users ADD brewed_cider BIGINT(25) NOT NULL DEFAULT 0; ALTER TABLE users ADD brewed_vodka BIGINT(25) NOT NULL DEFAULT 0;   Add items: Bottle of Beer Bottle of Whiskey Bottle of Cider Bottle of Vodka You will just have to change the item id in the code. Save this image as "brewery.jpg" and add it to your images folder on your database: [ATTACH]2103[/ATTACH] I would like to thank [MENTION=67703]adamhull[/MENTION] for the help with parts of my code.   If you have any problems with the script mail me Edit your inventory.php file. And add for each item id if($i['itmid'] == 278) { print " [<a href='brewery.php?action=drinkwhiskey'>Drink</a>]"; } Just change item id if($i['itmid'] == 277) { print " [<a href='brewery.php?action=drinkbeer'>Drink</a>]"; } And so on,you should get the drift now.
  3. Now finished. Just have to make a few changes then it will be released..
  4. This one worked, thank you
  5. Still not updating anything or sending event.. And what do you mean by this? Remove the comment when this works, change your cron URL to add ?code=enter config code found in config.php if(!isset($_GET['code']) || isset($_GET['code']) != $_CONFIG['code']) { return; }
  6. I wouldn't have a clue, that's how it is in my global_func.php folder. - - - Updated - - - And I am using.Ravan's at the moment...
  7. So what do you mean by the. include_once ("class_db_mysql.php") in the cron file?
  8. Fatal error: Call to a member function query() on a non-object in /home/braidz/public_html/lotto_cron.php on line 11
  9. Fatal error: Call to a member function escape() on a non-object in /home/braidz/public_html/lotto_cron.php on line 8
  10. And that is what I'm trying to figure out. Why is it returning just a plain white screen with no errors, and I'm getting no results? And troll? Really, I'm not a troll, I'm just a complete dumb ass, who has no clue what I'm doing, and thinking about just giving up on it, because I can't code for crap. And like you say, I'm never going to learn anything, so I may as well give up on it while I'm ahead of it..
  11. Where do I find this? And what would I enter? Aha! :/
  12. No.Cron code? - - - Updated - - -   How about this? <?php include_once "global_func.php"; include "config.php"; include "language.php"; global $db, $ir, $userid; $text=mysql_escape($text); $db->escape("INSERT INTO events VALUES('',$userid,UNIX_TIMESTAMP(),0,'$text')") or die(mysql_error()); $db->query("UPDATE users SET new_events=new_events+1 WHERE userid={$userid}") or die(mysql_error()); return 1; } global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']; $db->connect(); $c=$db->connection_id; $random_select = $db->query("SELECT `user` FROM `lottery_players` ORDER BY RAND() LIMIT 1") or die(mysql_error()); $rs = $db->fetch_row($random_select); $lotto_config = $db->query("SELECT `ticketprice` FROM `lottery_config`") or die(mysql_error()); $lc = $db->fetch_single($lotto_config); $winnings = $db->query("SELECT COUNT(`user`) FROM `lottery_players`") or die(mysql_error()); $win = $db->fetch_single($winnings); $gain = $lc * $win; $db->query("UPDATE `users` SET `money` = `money` + {$gain} WHERE `userid` = {$rs['user']}") or die(mysql_error()); event_add($rs['user'], "You have won ".money_formatter($gain)." on the lottery."); $db->query("TRUNCATE TABLE `lottery_players`") or die(mysql_error()); $db->query("UPDATE `users` SET `tickets` = 0") or die(mysql_error()); ?> Still getting no results though..
  13. I'm entering /lotto_cron.php at the end of my url
  14. Just entering it into my address bar
  15. No errors are displaying. I'm not sure if there is an open connection or not. And no I don't think I've forgotten or misspelt anything.. This is not the only custom cron I've had problems with..
  16. The queries. And I'm not sure what the go is there. It's annoying, but it's only when I post the scripts on here that I get the stars
  17. Not running at all. This is what I have <?php function event_add($userid,$text,$connection=0) { global $db, $ir, $userid; $text=mysql_escape($text); $db->query("INSERT INTO events VALUES('',$userid,UNIX_TIMESTAMP(),0,'$text')") or die(mysql_error()); $db->query("UPDATE users SET new_events=new_events+1 WHERE userid={$userid}") or die(mysql_error()); return 1; } include_once "global_func.php"; include "config.php"; include "language.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], *$_CONFIG['username'], *$_CONFIG['password'], *$_CONFIG['database'], *$_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; * $random_select = $db->query("SELECT `user` FROM `lottery_players` ORDER BY RAND() LIMIT 1") or die(mysql_error()); * $rs = $db->fetch_row($random_select); * $lotto_config = $db->query("SELECT `ticketprice` FROM `lottery_config`") or die(mysql_error()); * $lc = $db->fetch_single($lotto_config); * $winnings = $db->query("SELECT COUNT(`user`) FROM `lottery_players`") or die(mysql_error()); * $win = $db->fetch_single($winnings); * $gain = $lc * $win; * * * $db->query("UPDATE `users` SET `money` = `money` + {$gain} WHERE `userid` = {$rs['user']}") or die(mysql_error()); * event_add($rs['user'], "You have won ".money_formatter($gain)." on the lottery."); * $db->query("TRUNCATE TABLE `lottery_players`") or die(mysql_error()); * $db->query("UPDATE `users` SET `tickets` = 0") or die(mysql_error()); * ?>
  18. Still no luck with the cron... Looks like I may have to just scrap the lottery on my game if I can't get the cron working
  19. I will have a read through, and okay thanks, I will try that, and no I don't, why is that?
  20. Okay, let me know when you've had a look mate
  21. Now when I input the number of Bottles of Beer I want to exchange, it truncates my function brewed_beer <?php require_once("globals.php"); if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } if($ir['brew_time']) { die("You can't brew for another {$ir['brew_time']} minutes, when your current batch finishes."); } if($ir['brew'] == 10) { echo 'You have already brewed 10 times today, come back tomorrow'; $h->endpage(); die; } $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : ''; switch($_GET['action']){ case 'beer': brew_beer(); break; case 'drinkbeer': drink_beer(); break; case 'brewbeer': brew_beer_sub(); break; case 'whiskey': brew_whiskey(); break; case 'collectbeer': collect_beer(); break; case 'beercollected': beer_collected(); break; default: brewery(); break; } function brewery() { global $db,$ir,$c,$userid,$h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table> <h3>Your Brewery</h3>"; echo " You are sitting in your shed. </br>What would you like to brew?</br>"; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'>Brewery Options</th> </tr> <tr> <td>Beer</td> <td> <a href='brewery.php?action=beer'>Brew</a> </td> </tr> <tr> <td>Whiskey</td> <td> <a href='brewery.php?action=whiskey'>Brew</a> </td> </tr> </tr> <tr> <td>Cider</td> <td> <a href='brewery.php?action=cider'>Brew</a> </td> </tr> </tr> <tr> <td>Vodka</td> <td> <a href='brewery.php?action=vodka'>Brew</a> </td> </tr> </table> "; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'>Collection of Alcohol</th> </tr> <tr> <td>Beer</td> <td> <a href='brewery.php?action=collectbeer'>Collect</a> </td> </tr> <tr> <td>Whiskey</td> <td> <a href='brewery.php?action=whiskey'>Collect</a> </td> </tr> </tr> <tr> <td>Cider</td> <td> <a href='brewery.php?action=cider'>Collect</a> </td> </tr> </tr> <tr> <td>Vodka</td> <td> <a href='brewery.php?action=vodka'>Collect</a> </td> </tr> </table> "; print "<h3><font color='red'>This module is not complete and is still in the early stage of production.</br> Not all functions will work properly.</font></h3>"; } function brew_beer() { print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Beer</h3>"; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'> Beer Information</th> </tr> <tr> <td>Time to brew Beer?</td> <td>25 Minutes</td> </tr> <tr> <td>Brave needed to brew Beer?</td> <td>5 Brave</td> </tr> <td>What does Beer do?</td> <td>Gives you an energy boost of 25 Energy</td> </tr> </table> <form method='post' action='brewery.php?action=brewbeer'> <input type='submit' name='brewbeer' value='Brew Beer' /> </form> "; } function brew_whiskey() { print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Whiskey</h3>"; echo " <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'> <tr> <th colspan='3'> Whiskey Information</th> </tr> <tr> <td>Time to brew Whiskey?</td> <td>25 Minutes</td> </tr> <tr> <td>Brave needed to brew Whiskey?</td> <td>10 Brave</td> </tr> <td>What does Whiskey do?</td> <td>25 boost to your brave</td> </tr> </table> <form method='post' action='brewery.php?action=brewbeer'> <input type='submit' name='brewbeer' value='Brew Whiskey' /> </form> "; } function brew_beer_sub() { if ($_POST['brewbeer']){ global $db,$ir,$c,$userid,$h,$beer; $beer = rand(1, 6); echo "You only had enough ingredients to brew, {$beer} Bottle(s) of Beer!</br> Come back in 25 minutes to collect your beer"; $db->query("UPDATE users SET brew=brew + 1 WHERE userid=$userid"); $db->query("UPDATE users SET brewed_beer=brewed_beer + $beer WHERE userid=$userid"); $db->query("UPDATE users SET brave=brave - 5 WHERE userid=$userid"); $db->query("UPDATE users SET brew_time=brew_time + 25 WHERE userid=$userid"); if($ir['brew_time'] == 0) { } } } function drink_beer() { global $db, $ir, $c, $userid, $h; $query = $db->query("SELECT `inv_qty` FROM inventory WHERE inv_userid = {$userid} AND `inv_itemid` = 277"); $itemid = $db->num_rows($query); if (!$db->num_rows($query)) { echo "You don't have enough beer"; die; } else { echo "You drank 1 Bottle of Beer, you gained 20 energy"; $db->query("UPDATE users SET energy=energy + 1 WHERE userid=$userid"); item_remove($userid, 277, 1); } } function collect_beer() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Collect Beer</h3>"; echo "You have ". number_format($ir["brewed_beer"]) ." Bottles of Beer, how many would you like to collect?"; echo "<form method='post' action='brewery.php?action=beercollected'> Beer(s): <input style='background: #BCC6CC;' type='text' name='amount' value='1' maxlength='10' /> </br><input type='submit' name='beercollected' value='Collect' /> </form>"; } function beer_collected() { global $db, $ir, $c, $userid, $h, $_POST; $ir['brewed_beer']= abs((int) $ir['brewed_beer']); if($_POST['amount'] > $ir['brewed_beer']){ echo "You don't have this much beer you only have ". number_format($ir["brewed_beer"]) ." Bottles of Beer"; $h->endpage(); die; }else{ echo "You have collected ". number_format($ir["amount"]) ." Bottles of Beer, you have ". number_format($ir["brewed_beer"]) ." left"; $db->query("UPDATE users SET brewed_beer=brewed_beer - {$ir['brewed_beer']} WHERE userid=$userid"); item_add($userid, 277, ($_POST['amount'])); } } ?>   I'm getting this here, I set the table as 5 and only wanted to collect 1 This is what I get: You have collected 0 Bottles of Beer, you have 0 left When I should get: You have collected 1 Bottles of Beer, you have 4 left And it's also setting "brewed_beer" back to 0
  22. Like this? function collect_beer() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Collect Beer</h3>"; echo "<form method='post' action='brewery.php?action=beercollected'> Beer(s): <input style='background: #BCC6CC;' type='text' name='amount' value='1' maxlength='10' /> </br><input type='submit' name='beercollected' value='Collect' /> </form>"; } function beer_collected() { global $db, $ir, $c, $userid, $h, $_POST; $ir['brewed_beer']= abs((int) $ir['brewed_beer']); if($_POST['amount'] > $ir['brewed_beer']){ echo "You don't have this much beer"; { $h->endpage(); die; }else{ echo "You have collected your beer"; $db->query("UPDATE users SET brewed_beer=brewed_beer - {$ir['brewed_beer']} WHERE userid=$userid"); item_add($userid, 277, ($_POST['amount'])); } } } ?>   And yes, but I did try, and I tried numerous things and just couldn't work it out..
  23. Alright, I changed it so you have to collect the alcohol after it has been brewed, instead of automaticly being Credited the item, I also made it so the user can input the amount they want, but they can collect more than they are supposed to. How can I fix this, so if they try get more than the amount they can actually collect, it comes up with an error message like "You don't have that much Beer" or something like that. This is what I have done function collect_beer() { global $db, $ir, $c, $userid, $h; print "<div class='generalinfo_txt'> <div><img src='images/info_left.jpg' alt='' /></div> <div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div> <div><img src='images/info_right.jpg' alt='' /></div> </div> <div class='generalinfo_simple'> <h3>Collect Beer</h3>"; echo "<form method='post' action='brewery.php?action=beercollected'> Beer(s): <input style='background: #BCC6CC;' type='text' name='amount' value='1' maxlength='10' /> </br><input type='submit' name='beercollected' value='Collect' /> </form>"; } function beer_collected() { global $db, $ir, $c, $userid, $h, $_POST; $_POST['brewed_beer']= abs((int) $_POST['brewed_beer']); if($_POST['brewed_beer'] <= 0) { echo "You don't have this much beer"; { } global $db, $ir, $c, $userid, $h; if($ir['brewed_beer'] == 0) { echo 'You have no beer already brewed to collect, you better start brewing'; $h->endpage(); die; }else{ echo "You have collected your beer"; $db->query("UPDATE users SET brewed_beer=brewed_beer - {$ir['brewed_beer']} WHERE userid=$userid"); item_add($userid, 277, ($_POST['amount'])); } } } ?>   Can anyone figure it out? I don't want the style of my code changed either, because it will make it too difficult to keep going. I know my coding is outdated, but that's the only way I know to code for now
  24. Thanks, I got it, copied the code, and it fixed the attack problem. Now I'm having a problem with normal Stats, it's not showing them correctly, such as my strength is at 14,000+ and it's just saying 14 I will provide a screen shot.. What could be causing this [ATTACH]2100[/ATTACH]
  25. Thanks And to be honest, I haven't watched any tutorials, I have just been learning from here, (yes I get help with some stuff) so yeah I really only know what I'm coding the in php, so not all that much, I will slowly learn, i have watched like three tutorials, but I find them confusing haha. So I'm just going to teach myself
×
×
  • Create New...