Jump to content

PHPStudent

Members
  • Content Count

    74
  • Joined

  • Last visited

Community Reputation

21 Excellent

About PHPStudent

  • Rank
    Beginner

Recent Profile Visitors

207 profile views
  1. This one doesnt credit the user automatically either unfortunately
  2. PHPStudent

    GLV2 Travel Mod

    Umm, correct if me im wrong, but shouldnt that an be incentive to train your stats and level so you can travel to attack these higher/stronger players with the possibility of a donator item that allows lower levels to bypass that restriction maybe, just a thought
  3. Oh I shouldve checked, thanks
  4. Some ideas i was thinking about for GL engine; A forum system similar to mccodes and makewebgames would be nice (with forum avators and signatures) A a competition system to keep up player activity (i.e. most crimes committed, jail busts etc) and prizes for either top 3, top 5, or top ten School system to gain strength, guard, agility, labour and IQ
  5. If you find the if statement for that error message and completely remove it, it should work as it did for me
  6. No one will agree to those terms. 10-20% is too low for the amount of work required and for a game that presumably makes no money yet
  7. Are you making any budget Mccodes themes? Would potentially be interested
  8. PHPStudent

    Crystal Bank

    Version 1.0.0

    1 download

    Simple crystal bank converted from the original city bank. Instructions: 1. Import SQL file 2. Upload crystalbank.php Done

    Free

  9. Divorce function is not 100% working for me. It asks me to input a lower case "yes" in the field but really I can enter anything and it'll still process the divorce, can anyone help me? whole file: <?php $housequery=1; @include_once(DIRNAME(__FILE__) .'/globals.php'); if($ir['married']==0) { echo'You are not married.'; exit; } // Get the married persons data $m = $db->fetch_row($db->query(sprintf("SELECT u.userid, u.username, u.money, u.crystals, u.bankmoney, u.cybermoney, u.maxwill, u.marriedwill, us.*, h.hNAME, h.hWILL FROM users AS u LEFT JOIN userstats AS us ON u.userid=us.userid LEFT JOIN houses AS h ON u.maxwill=h.hWILL WHERE u.userid=%u", $ir['married']))); $data = array_merge($_GET, $_POST); //Not using $_REQUEST because it includes $_COOKIE $data['act'] = isset($data['act']) && is_string($data['act']) ? strtolower(trim($data['act'])) : false; $array = array('moneyget', 'moneysend', 'bankget', 'banksend', 'crystalget', 'crystalsend', 'cyberget', 'cybersend', 'movein', 'moveout', 'view_requests', 'divorce', 'request', 'index', ''); //Small array for actions. if(!in_array($data['act'], $array)) { echo'<big>Error!</big><br /> There seems to be an error, please go back and try again.'; exit; } switch($data['act']) { case'moneyget': Get_Money(); break; case'moneysend': Give_Money(); break; case'bankget': Get_Bank(); break; case'banksend': Give_Bank(); break; case'crystalget': Get_Crystal(); break; case'crystalsend': Give_Crystal(); break; case'cyberget': Get_Cyber(); break; case'cybersend': Give_Cyber(); break; /* case'movein': Move_In(); break; // I'm not using shared housing so I've blocked this out case'moveout': Move_Out(); break; */ case'view_requests': View_Requests(); break; case'divorce': Divorce(); break; case'request': Request(); break; default: Marriage(); break; } function Money_UnFormatter($number) { $number = str_replace(array(',','$','+','-'), '', $number); if(!is_numeric($number)) { return false; exit; } return $number; } function Marriage() { global $ir, $db, $m, $h; $requests = $db->num_rows($db->query(sprintf("SELECT ID FROM `marriage_requests` WHERE (User_To=%u)", $ir['userid']))); echo'<h3>You are married to <a href="viewuser.php?u='.$m['userid'].'"><u>'.$m['username'].'</u></a> ['.number_format($m['userid']).']</h3>'; $m['cybermoney'] = ($m['cybermoney'] == -1) ? 'No Account' : money_formatter($m['cybermoney']); $ir['cybermoney'] = ($ir['cybermoney'] == -1) ? 'No Account' : money_formatter($ir['cybermoney']); $m['bankmoney'] = ($m['bankmoney'] == -1) ? 'No Account' : money_formatter($m['bankmoney']); $ir['bankmoney'] = ($ir['bankmoney'] == -1) ? 'No Account' : money_formatter($ir['bankmoney']); ?> <table width="90%" cellspacing="1" class="table"> <tr style="text-align: center;"> <th width="20%">&nbsp;</th> <th>You</th> <th><?php echo $m['username'] ?>'s</th> </tr> <tr style="text-align: center;"> <td style="text-align: center;"><big>Money</big><br /> <a href="?act=moneysend">Send</a> || <a href="?act=moneyget">Request</a></td><td><?php echo money_formatter($ir['money']) ?></td> <td><?php echo money_formatter($m['money']) ?></td> </tr> <tr style="text-align: center;"> <td><big>Crystals</big><br /> <a href="?act=crystalsend">Send</a> || <a href="?act=crystalget">Request</a></td><td><?php echo number_format($ir['crystals']) ?></td> <td><?php echo number_format($m['crystals']) ?></td> </tr> <tr style="text-align: center;"> <td><big>Bank Money</big><br /> <a href="?act=banksend">Send</a> || <a href="?act=bankget">Request</a></td><td><?php echo $ir['bankmoney'] ?></td> <td><?php echo $m['bankmoney'] ?></td> </tr> <tr style="text-align: center;"> <td><big>Cyber Money</big><br /> <a href="?act=cybersend">Send</a> || <a href="?act=cyberget">Request</a></td><td><?php echo $ir['cybermoney'] ?></td> <td><?php echo $m['cybermoney'] ?></td> </tr> <tr style="text-align: center;"> <td><big>Houses</big><br /></td> <td><?php echo $ir['hNAME'] ?><br /><small>(<?php echo $ir['maxwill'] ?> will)</small></td><td><?php echo $m['hNAME'] ?><br /><small>(<?php echo $m['maxwill'] ?> will)</small></td></tr> <tr style="text-align: center;"> <td colspan="3"><a href="?act=view_requests">View Requests (<?php echo number_format($requests) ?>)</a> <br> <a href="?act=divorce">Get a Divorce</a></td> </tr> </table> <br /> <br /> <table width="90%" cellspacing="1" class="table"> <tr style="text-align: center;"> <th width="15%">Stats</th> <th>Yours</th> <th><?php echo $m['username'] ?>'s</th> </tr> <tr style="text-align: center;"> <td>Strength</td><td><?php echo number_format($ir['strength']) ?></td> <td><?php echo number_format($m['strength']) ?></td> </tr> <tr style="text-align: center;"> <td>Agility</td><td><?php echo number_format($ir['agility']) ?></td> <td><?php echo number_format($m['agility']) ?></td> </tr> <tr style="text-align: center;"> <td>Guard</td><td><?php echo number_format($ir['guard']) ?></td> <td><?php echo number_format($m['guard']) ?></td> </tr style="text-align: center;"> <tr style="text-align: center;"> <td>Labour</td><td><?php echo number_format($ir['labour']) ?></td> <td><?php echo number_format($m['labour']) ?></td> </tr> </table> <?php } function Get_Money() { global $data, $ir, $db, $m, $h; if(isset($data['money'])) { $data['money'] = Money_UnFormatter($data['money']); $data['money'] = abs(@intval($data['money'])); $data['reasonwhy'] = strip_tags(addslashes($data['reasonwhy'])); if($data['money'] > $m['money']) { echo'Your partner doesnt have this much money.'; exit; } $db->query(sprintf("INSERT INTO `marriage_requests` VALUES('', %u, %u, '%s', %d, 0, 0, 0)", $m['userid'], $ir['userid'], $data['reasonwhy'], $data['money'])); event_add($m['userid'], "Your partner has requested ".money_formatter($data['money'])." from your hand please accept/decline this in the marriage requests."); echo'You have requested '.money_formatter($data['money']).' from your partner.'; exit; } ?> <span style="font-weight: bold;">Requesting Money</span><br /> You can request up to: <?php echo money_formatter($m['money']) ?><br /> <form action="" method="post"> <input type="hidden" name="act" value="moneyget"> Ammout to request: <input type="text" name="money" value="<?php echo money_formatter($m['money']) ?>" /><br /> Reason why: <textarea name="reasonwhy"></textarea><br /> <input type="submit" value="Request!" /> </form> <?php } function Get_Bank() { global $data, $ir, $db, $m, $h; if($m['bankmoney'] == -1) { echo'Your partner doesnt have a bank account.'; exit; } if($ir['bankmoney'] == -1) { echo'You don\'t have a bank account.'; exit; } if(isset($data['money'])) { $data['money'] = Money_UnFormatter($data['money']); $data['money'] = abs(@intval($data['money'])); $data['reasonwhy'] = strip_tags(addslashes($data['reasonwhy'])); if($data['money'] > $m['bankmoney']) { echo'Your partner doesnt have this much money in the bank.'; exit; } $db->query(sprintf("INSERT INTO `marriage_requests` VALUES('', %d, %d, '%s', 0, 0, 0, %d)", $m['userid'], $ir['userid'], $data['reasonwhy'], $data['money'])); event_add($m['userid'], "Your partner has requested ".money_formatter($data['money'])." from your bank please accept/decline this in the marriage requests."); echo'You have requested '.money_formatter($data['money']).' from your partner.'; exit; } ?> <span style="font-weight: bold;">Requesting Bank-money</span><br /> You can request up to: <?php echo money_formatter($m['bankmoney']) ?><br /> <form action="" method="post"> <input type="hidden" name="act" value="bankget"> Ammout to request: <input type="text" name="money" value="<?php echo money_formatter($m['bankmoney']) ?>" /><br /> Reason why: <textarea name="reasonwhy"></textarea><br /> <input type="submit" value="Request!" /> </form> <?php } function Get_Crystal() { global $data, $ir, $db, $m, $h; if(isset($data['crystals'])) { $data['crystals'] = abs(@intval($data['crystals'])); $data['reasonwhy'] = strip_tags(addslashes($data['reasonwhy'])); $db->query(sprintf("INSERT INTO `marriage_requests` VALUES('', %d, %d, '%s', 0, %d, 0, 0)", $m['userid'], $ir['userid'], $data['reasonwhy'], $data['crystals'])); event_add($m['userid'], "Your partner has requested ".number_format($data['crystals'])." crystals please accept/decline this in the marriage requests."); echo'You have requested '.number_format($data['crystals']).' crystals from your partner.'; exit; } ?> <span style="font-weight: bold;">Requesting Crystals</span><br /> You can request up to: <?php echo number_format($m['crystals']) ?> crystals<br /> <form action="" method="post"> <input type="hidden" name="act" value="crystalget"> Ammout to request: <input type="text" name="crystals" value="<?php echo number_format($m['crystals']) ?>" /><br /> Reason why: <textarea name="reasonwhy"></textarea><br /> <input type="submit" value="Request!" /> </form> <?php } function Get_Cyber() { global $data, $ir, $db, $m, $h; if($m['cybermoney'] == -1) { echo'Your partner doesnt have a cyber bank account.'; exit; } if($ir['cybermoney'] == -1) { echo'You don\'t have a cyber bank account.'; exit; } if(isset($data['money'])) { $data['money'] = Money_UnFormatter($data['money']); $data['money'] = abs(@intval($data['money'])); $data['reasonwhy'] = strip_tags(addslashes($data['reasonwhy'])); if($data['money'] > $m['cybermoney']) { echo'Your partner doesnt have this much money in the cyber bank.'; exit; } $db->query(sprintf("INSERT INTO `marriage_requests` VALUES('', %d, %d, '%s', 0, 0, %d, 0)", $m['userid'], $ir['userid'], $data['reasonwhy'], $data['money'])); event_add($m['userid'], "Your partner has requested ".money_formatter($data['money'])." from your cyber bank please accept/decline this in the marriage requests."); echo'You have requested '.money_formatter($data['money']).' from your partner.'; exit; } ?> <span style="font-weight: bold;">Requesting Cyber-money</span><br /> You can request up to: <?php echo money_formatter($m['cybermoney']) ?><br /> <form action="" method="post"> <input type="hidden" name="act" value="cyberget"> Ammout to request: <input type="text" name="money" value="<?php echo money_formatter($m['cybermoney']) ?>" /><br /> Reason why: <textarea name="reasonwhy"></textarea><br /> <input type="submit" value="Request!" /> </form> <?php exit; } function View_Requests() { global $db, $ir, $m, $h; echo'<span style="font-weight: bold;">Viewing Requests</span><br /> <table width="90%" cellspacing="1" class="table"> <tr> <th width="20%">Amount wanted</th> <th>Reason</th> <th width="22%">Links</th> </tr>'; $Requests = $db->query(sprintf("SELECT * FROM `marriage_requests` WHERE User_To=%d", $ir['userid'])); if($db->num_rows($Requests) == 0) { echo'<tr style="text-align: center; text-weight: bold;"><td colspan="4">You have no requests</td></tr>'; } $type=""; $format=""; $amout=""; $reason=""; while($ma = $db->fetch_row($Requests)) { if($ma['Money'] != 0) { $amount = money_formatter($ma['Money']).' Money'; } if($ma['Crystals'] > 0) { $amount = number_format($ma['Crystals']).' Crystals'; } if($ma['Cyber_Money'] > 0) { $amount = money_formatter($ma['Cyber_Money']).' Cyber money'; } if($ma['Bank_Money'] > 0) { $amount = money_formatter($ma['Bank_Money']).' Bank money'; } $reason = stripslashes($ma['Reason']); ?> <tr> <td style="text-align: center;"><?php echo $amount ?></td> <td style="text-align: center;"><?php echo $reason ?></td> <td style="text-align: center;"><a href="?act=request&action=accept&ID=<?php echo $ma['ID'] ?>">Accept</a> &nbsp;&nbsp;&nbsp;&nbsp; || &nbsp;&nbsp;&nbsp;&nbsp; <a href="?act=request&action=decline&ID=<?php echo $ma['ID'] ?>">Decline</a></td> </tr> <?php } echo'</table>'; exit; } function Request() { global $data, $db, $ir, $m, $h; if(!isset($data['action'])) { echo'You havent selected an option.'; exit; } if(!isset($data['ID'])) { echo'You havent selected anything to '.$data['action'].'.'; exit; } $ma = $db->fetch_row($db->query(sprintf("SELECT * FROM `marriage_requests` WHERE User_To=%d", $ir['userid']))); if($m === FALSE) { echo'This doesnt exist.'; } if($data['action'] == 'accept') { if($ma['Crystals'] != 0 && $ir['crystals'] >= $ma['Crystals']) { $db->query(sprintf("UPDATE users SET crystals=crystals+%u WHERE userid=%d", $ma['Crystals'], $ma['User_From'])); $db->query(sprintf("UPDATE users SET crystals=crystals-%u WHERE userid=%d", $ma['Crystals'], $ir['userid'])); echo'You have given '.$m['username'].' '.number_format($ma['Crystals']).' crystals.'; event_add($ma['User_From'], $ir['username'].' gave you the requested '.number_format($ma['Crystals']).' Crystals you wanted.'); $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } if($ma['Money'] != 0 && $ir['money'] >= $ma['Money']) { $db->query(sprintf("UPDATE users SET money=money+%u WHERE userid=%d", $ma['Money'], $ma['User_From'])); $db->query(sprintf("UPDATE users SET money=money-%u WHERE userid=%d", $ma['Money'], $ir['userid'])); echo'You have given '.$m['username'].' '.money_formatter($ma['Money']).'.'; event_add($ma['User_From'], $ir['username'].' gave you the requested '.money_formatter($ma['Money']).' you wanted.'); $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } if($ma['Bank_Money'] != 0 && $ir['bankmoney'] >= $ma['Bank_Money']) { $db->query(sprintf("UPDATE users SET bankmoney=bankmoney+%u WHERE userid=%d", $ma['Bank_Money'], $ma['User_From'])); $db->query(sprintf("UPDATE users SET bankmoney=bankmoney-%u WHERE userid=%d", $ma['Bank_Money'], $ir['userid'])); echo'You have given '.$m['username'].' '.money_formatter($ma['Bank_Money']).'.'; event_add($ma['User_From'], $ir['username'].' gave you the requested '.money_formatter($ma['Bank_Money']).' bank money you wanted.'); $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } if($ma['Cyber_Money'] != 0 && $ir['cybermoney'] >= $ma['Cyber_Money']) { $db->query(sprintf("UPDATE users SET cybermoney=cybermoney+%u WHERE userid=%d", $ma['Cyber_Money'], $ma['User_From'])); $db->query(sprintf("UPDATE users SET cybermoney=cybermoney-%u WHERE userid=%d", $ma['Cyber_Money'], $ir['userid'])); echo'You have given '.$m['username'].' '.money_formatter($ma['Cyber_Money']).'.'; event_add($ma['User_From'], $ir['username'].' gave you the requested '.money_formatter($ma['Cyber_Money']).' cyber money you wanted.'); $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } } elseif($data['action'] == 'decline') { if($ma['Crystals'] != 0) { event_add($ma['User_From'], $ir['username'].' refused to give you the '.number_format($ma['Crystals']).' crystals you requested.'); echo'You have declined the crystal request.'; $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } if($ma['Money'] != 0) { event_add($ma['User_From'], $ir['username'].' refused to give you the '.number_format($ma['Money']).' you requested.'); echo'You have declined this request.'; $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } if($ma['Cyber_Money'] != 0) { event_add($ma['User_From'], $ir['username'].' refused to give you the '.number_format($ma['Cyber_Money']).' cyber money you requested.'); echo'You have declined this request.'; $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } if($ma['Bank_Money'] != 0) { event_add($ma['User_From'], $ir['username'].' refused to give you the '.number_format($ma['Bank_Money']).' bank money you requested.'); echo'You have declined this request.'; $db->query(sprintf("DELETE FROM `marriage_requests` WHERE ID=%d", $data['ID'])); } } else {echo'What'; } } function Give_Money() { global $data, $db, $m, $ir, $h; if(isset($data['money'])) { $data['money'] = Money_UnFormatter($data['money']); $data['money'] = abs(@intval($data['money'])); if($ir['money'] >= $data['money']) { $db->query(sprintf("UPDATE users SET money=money+%d WHERE userid=%u", $data['money'], $m['userid'])); $db->query(sprintf("UPDATE users SET money=money-%d WHERE userid=%u", $data['money'], $ir['userid'])); event_add($m['userid'], $ir['username'].' has sent you '.money_formatter($data['money']).'.'); echo'You have sent '.money_formatter($data['money']).' to '.$m['username'].'.'; exit; } echo'You don\'t have enough money to send that.'; exit; } ?> <span style="font-weight: bold;"><u>Sending money to <?php echo $m['username'] ?></u></span><br /> <form action="" method="post"> Amount to send: <input type="text" name="money" value="<?php echo money_formatter($ir['money']) ?>" /><br /> <input type="submit" value="Send" /> </form> <?php } function Give_Bank() { global $data, $db, $m, $ir, $h; if($m['bankmoney'] == -1) { echo'Your partner doesnt have a bank account.'; exit; } if($ir['bankmoney'] == -1) { echo'You don\'t have a bank account.'; exit; } if(isset($data['money'])) { $data['money'] = Money_UnFormatter($data['money']); $data['money'] = abs(@intval($data['money'])); if($ir['bankmoney'] >= $data['money']) { $db->query(sprintf("UPDATE users SET bankmoney=bankmoney+%d WHERE userid=%u", $data['money'], $m['userid'])); $db->query(sprintf("UPDATE users SET bankmoney=bankmoney-%d WHERE userid=%u", $data['money'], $ir['userid'])); event_add($m['userid'], $ir['username'].' has sent you '.money_formatter($data['money']).' banked money.'); echo'You have sent '.money_formatter($data['money']).' bank money to '.$m['username'].'.'; exit; } echo'You don\'t have enough money to send that.'; exit; } ?> <span style="font-weight: bold;"><u>Sending bank money to <?php echo $m['username'] ?></u></span><br /> <form action="" method="post"> Amount to send: <input type="text" name="money" value="<?php echo money_formatter($ir['bankmoney']) ?>" /><br /> <input type="submit" value="Send" /> </form> <?php } function Give_Crystal() { global $data, $db, $m, $ir, $h; if(isset($data['crystals'])) { $data['crystals'] = Money_UnFormatter($data['crystals']); $data['money'] = abs(@intval($data['crystals'])); if($ir['crystals'] >= $data['crystals']) { $db->query(sprintf("UPDATE users SET crystals=crystals+%d WHERE userid=%u", $data['money'], $m['userid'])); $db->query(sprintf("UPDATE users SET crystals=crystals-%d WHERE userid=%u", $data['money'], $ir['userid'])); event_add($m['userid'], $ir['username'].' has sent you '.number_format($data['crystals']).' crystals.'); echo'You have sent '.number_format($data['money']).' crystals to '.$m['username'].'.'; exit; } echo'You don\'t have enough to send that amount.'; exit; } ?> <span style="font-weight: bold;"><u>Sending crystals to <?php echo $m['username'] ?></u></span><br /> <form action="" method="post"> Amount to send: <input type="text" name="crystals" value="<?php echo number_format($ir['crystals']) ?>" /><br /> <input type="submit" value="Send" /> </form> <?php } function Give_Cyber() { global $data, $db, $m, $ir, $h; if($m['cybermoney'] == -1) { echo'Your partner doesnt have a cyber bank account.'; exit; } if($ir['cybermoney'] == -1) { echo'You don\'t have a cyber bank account.'; exit; } if(isset($data['money'])) { $data['money'] = Money_UnFormatter($data['money']); $data['money'] = abs(@intval($data['money'])); if($ir['cybermoney'] >= $data['money']) { $db->query(sprintf("UPDATE users SET cybermoney=cybermoney+%d WHERE userid=%u", $data['money'], $m['userid'])); $db->query(sprintf("UPDATE users SET cybermoney=cybermoney-%d WHERE userid=%u", $data['money'], $ir['userid'])); event_add($m['userid'], $ir['username'].' has sent you '.money_formatter($data['money']).' cyber money.'); echo'You have sent '.money_formatter($data['money']).' cyber money to '.$m['username'].'.'; exit; } echo'You don\'t have enough money to send that.'; exit; } ?> <span style="font-weight: bold;"><u>Sending bank money to <?php echo $m['username'] ?></u></span><br /> <form action="" method="post"> Amount to send: <input type="text" name="money" value="<?php echo money_formatter($ir['cybermoney']) ?>" /><br /> <input type="submit" value="Send" /> </form> <?php } function Divorce() { global $data, $db, $ir, $m, $h; if(isset($data['yesorno']) == 'yes') { $theirwill = ($m['marriedwill'] !=0) ? ',maxwill=marriedwill,marriedwill=0' : ''; $mywill = ($ir['marriedwill'] != 0) ? ',maxwill=marriedwill,marriedwill=0' : ''; $db->query(sprintf("UPDATE users SET married=0%s WHERE userid=%d", $theirwill, $m['userid'])); $db->query(sprintf("UPDATE users SET married=0%s WHERE userid=%d", $mywill, $ir['userid'])); event_add($m['userid'], 'Your partner deivorced you.'); echo'You have divorced your partner.'; } if(isset($data['clicked'])) { echo'To make sure its a final decision, type lower case "yes" in the field. '; ?> <form action="" method="post"> <input type="text" name="yesorno" value="no" /><br /> <input type="submit" name="imsure" value="Do it!" /> <input type="reset" value="Don't do it!"/> </form> <?php } else { ?> <span style="font-weight: bold;"><u>Divorcing <?php echo $m['username'] ?></u></span><br /> Are you sure? <form action="" method="post"> <input type="submit" name="clicked" value="Yes!" /> </form> <?php } } divorce function specifically: function Divorce() { global $data, $db, $ir, $m, $h; if(isset($data['yesorno']) == 'yes') { $theirwill = ($m['marriedwill'] !=0) ? ',maxwill=marriedwill,marriedwill=0' : ''; $mywill = ($ir['marriedwill'] != 0) ? ',maxwill=marriedwill,marriedwill=0' : ''; $db->query(sprintf("UPDATE users SET married=0%s WHERE userid=%d", $theirwill, $m['userid'])); $db->query(sprintf("UPDATE users SET married=0%s WHERE userid=%d", $mywill, $ir['userid'])); event_add($m['userid'], 'Your partner deivorced you.'); echo'You have divorced your partner.'; } if(isset($data['clicked'])) { echo'To make sure its a final decision, type lower case "yes" in the field. '; ?> <form action="" method="post"> <input type="text" name="yesorno" value="no" /><br /> <input type="submit" name="imsure" value="Do it!" /> <input type="reset" value="Don't do it!"/> </form> <?php } else { ?> <span style="font-weight: bold;"><u>Divorcing <?php echo $m['username'] ?></u></span><br /> Are you sure? <form action="" method="post"> <input type="submit" name="clicked" value="Yes!" /> </form> <?php } }
  10. 25 Silver Flakes = 1 Crystal 50 Gold Flakes = 1 Gold Coin Anything over 25 or 50 gives me a decimal number i.e. 1.12, and you end up losing any extra flakes you inputed that went over the 25 and 50 benchmark Is there any way you can only trade 25 silver flakes and 50 gold flakes for 1 coin/crystal at a time? So if I were to try to trade 28 or 55, I'd get an error instead "You can't trade more 25 at a time blah blah" EDIT: Fixed (kinda): <?php /** Mod Title: Refinery Info: Refine Gold/Silver/Copper flakes into their respected currency. By: TheMasterGeneral Cost: Free File: /refine.php */ require('refine_globals.php'); if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'refinegold': refine_gold(); break; case 'refinesilver': refine_silver(); break; case 'refinecopper': refine_copper(); break; default: refine_home(); break; } function refine_home() { global $h; echo "<h3>Refinery</h3> Welcome to the refinery. Here you may refine your flakes into money, crystals and gold coins! How awesome is that?! <br><font color=red><small><b>(Notice: Exchange rates are subject to change depending different factors e.g. game inflation.)</b></small></font> <br><br> Now, what would you like to refine?<br> [<a href='refine.php?action=refinecopper'><font color=brown>Refine Copper Flakes</font></a>]<br> [<a href='refine.php?action=refinesilver'><font color=silver>Refine Silver Flakes</font></a>]<br> [<a href='refine.php?action=refinegold'><font color=gold>Refine Gold Flakes</font></a>]"; //Gold coins is my third currency. If you //Do not have, then you can remove the link. $h->endpage(); } function refine_copper() { global $db,$userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidcopperflake']} AND `inv_userid` = $userid"); $totalcflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Copper</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinecopper' method='post'> How many flakes do you wish to refine into copper coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. <br>e.g. 10 Copper Flakes = $1<br><input type='text' name='amount' /> <input type='submit' value='Refine Copper Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requirecflakes']) { echo "You need to refine at least {$refine['requirecflakes']} flakes to get a dollar."; $h->endpage(); exit; } if ($_POST['amount'] > $refine['requirecflakes']) { echo "You can't refine more than 10 copper flakes in one go."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalcflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedcflakes = ($_POST['amount']/$refine['requirecflakes']); $flakesgonec = ($receivedcflakes*$refine['requirecflakes']); echo "You have refined {$_POST['amount']} Copper Flakes and gained \${$receivedcflakes}!"; item_remove($userid, $refine['itemidcopperflake'], $flakesgonec); $db->query( "UPDATE `users` SET `money` = `money` + {$receivedcflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } function refine_silver() { global $db, $userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidsilverflake']} AND `inv_userid` = $userid"); $totalsflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Silver</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinesilver' method='post'> How many flakes do you wish to refine into Crystals? If you enter a value higher than the amount of flakes needed, you will lose those flakes. <br>e.g. 25 Silver Flakes = 1 Crystal<br><input type='text' name='amount' /> <input type='submit' value='Refine Silver Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requiresflakes']) { echo "You need to refine at least {$refine['requiresflakes']} flakes to get a coin."; $h->endpage(); exit; } if ($_POST['amount'] > $refine['requiresflakes']) { echo "You can't refine more than {$refine['requiresflakes']} silver flakes in one go."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalsflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedsflakes = ($_POST['amount']/$refine['requiresflakes']); $flakesgones = ($receivedsflakes*$refine['requiresflakes']); echo "You have refined {$_POST['amount']} Silver Flakes and gained {$receivedsflakes} Silver Coins!"; item_remove($userid, $refine['itemidsilverflake'], $flakesgones); $db->query( "UPDATE `users` SET `crystals` = `crystals` + {$receivedsflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } function refine_gold() { global $db, $userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidgoldflake']} AND `inv_userid` = $userid"); $totalgflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Gold</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinegold' method='post'> How many flakes do you wish to refine into gold coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. <br>e.g. 50 Gold Flakes = 1 Gold Coin<br><input type='text' name='amount' /> <input type='submit' value='Refine Gold Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requiregflakes']) { echo "You need to refine at least {$refine['requiregflakes']} flakes to get a coin."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalgflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } if ($_POST['amount'] > 50) { echo "You can't refine more than 50 gold coins in one go."; $h->endpage(); exit; } //Refine complete. $receivedgflakes = ($_POST['amount']/$refine['requiregflakes']); $flakesgoneg = ($receivedgflakes*$refine['requiregflakes']); echo "You have refined {$_POST['amount']} Gold Flakes and gained {$receivedgflakes} Gold Coins!"; item_remove($userid, $refine['itemidgoldflake'], $flakesgoneg); $db->query( "UPDATE `users` SET `goldcoin` = `goldcoin` + {$receivedgflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } }
    @sniko Thanks for the module
  11. Will remove it, thank you. I tested this module on xampp and then donated to test if packs were auto credited and donator stats would update and neither did, is that because I was using xampp? Nevermind, it doesnt work either way. Just checked on a live server
  12. I think if you change your php version through cpanel to php 5, Dave's ajax one will work too. Atleast thats what I've been told.
  13. ❤️

    1. Sim

      Sim

      Ohhhh

    2. PHPStudent

      PHPStudent

      *big hug for simmy*

×
×
  • Create New...