
Joshua
Members-
Posts
1,271 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by Joshua
-
ALTER users ADD `signature` text NOT NULL; ALTER TABLE helps ;) ALTER TABLE `users` ADD `signature` VARCHAR(255) NOT NULL;
-
I'll be God and make sure vampires dont exist :p
-
Mod has been released, find it in the free mod section
-
Tnx bud, I'll be adding an Addiction/Rehab Plug-in Later today
-
function fertilize() { global $db,$h; if(!$_GET['ID'] || $_GET['ID'] != abs((int) $_GET['ID'])) { echo "You did not select a valid Drug from the list. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $check = $db->query("SELECT uf.`fID`,uf.`fQTY`,uf.`fTYPE`,d.`drugTYPE` FROM `userfarm` uf LEFT JOIN `drugs` d ON d.`dID`=uf.`fTYPE` WHERE `fID`=".$_GET['ID']." AND (`fuserid`=".$_SESSION['userid'].")"); $itd = $db->fetch_row($check); if(!$db->num_rows($check)) { echo "Please select a drug that you own and wish to fertilize. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $drugcost = $db->query("SELECT `fertilcost` FROM `drugs` WHERE `dID`=".$itd['fTYPE'].""); $costof = $db->fetch_row($drugcost); $costy = $costof['fertilcost']*$itd['fQTY']; echo "You have selected to fertilize this section of your ".stripslashes(htmlentities($itd['drugTYPE']))." at a cost of ".number_format($costy).". If this information is correct, Please select the confirmation link below to confirm your purchase. <center>[url='druglab.php?action=confirm&ID=".$_GET[']<u>[b]I hereby confirm purchase.[/b]</u>[/url] "; $h->endpage(); exit; } function confirm() { global $db,$h,$it; if(!$_GET['ID'] || $_GET['ID'] != abs((int) $_GET['ID'])) { echo "You did not select a valid Drug from the list. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $check = $db->query("SELECT uf.`fID`,uf.`fQTY`,uf.`fTYPE`,uf.`ffertilized`,d.`drugTYPE` FROM `userfarm` uf LEFT JOIN `drugs` d ON d.`dID`=uf.`fTYPE` WHERE `fID`=".$_GET['ID']." AND (`fuserid`=".$_SESSION['userid'].")"); $itd = $db->fetch_row($check); if(!$db->num_rows($check)) { echo "Please select a drug that you own and wish to fertilize. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } if($itd['ffertilized'] > 0) { echo "You have alreay fertilized this batch today. You do not want to over kill it! Please come back tomorrow and try again. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $drugcost = $db->query("SELECT `fertilcost` FROM `drugs` WHERE `dID`=".abs((int) $itd['fTYPE']).""); $costof = $db->fetch_row($drugcost); $costy = abs((int) $costof['fertilcost'])*abs((int) $itd['fQTY']); if($it['money'] < $costy) { echo "You cannot afford to co fertilize this batch of drugs. Please select another batch or save up to fertilize this one! You will need ".number_format($costy)." In order to carry out the transaction for this batch. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } else { echo "You have successfully fertilized this batch of drugs! Click below to return to your management center. [url='druglab.php'][b]Back[/b][/url]"; $db->query("UPDATE `userfarm` SET `fquality`=`fquality`+1, `ffertilized`=1 WHERE `fID`=".abs((int) $itd['fID'])." AND `fquality`<7"); $db->query("UPDATE `users` SET `money`=`money`-".abs((int) $costy)." WHERE `userid`=".$_SESSION['userid'].""); } } function harvest() { global $db,$h; if(!$_GET['ID'] || $_GET['ID'] != abs((int) $_GET['ID'])) { echo "You did not select a Drug Id, please return and try again. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $exists = $db->query("SELECT uf.`fID`,uf.`age`,uf.`fQTY`,uf.`fuserid`,uf.`fquality`,uf.`fTYPE`,d.`drugTYPE` FROM `userfarm` uf LEFT JOIN `drugs` d ON d.`dID`=uf.`fTYPE` WHERE uf.`age` > 6 AND uf.`fuserid`=".$_SESSION['userid']." AND (uf.`fID`=".$_GET['ID'].")"); if(!$db->num_rows($exists)) { echo "The drugs you have selected are not currently ready to be harvested or do not exist. Please try when they reach 7 days old! [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $iqr = $db->fetch_row($exists); if($iqr['fTYPE'] == 1) { $stat = 'guard'; } elseif($iqr['fTYPE'] == 2) { $stat = 'agility'; } else { $stat = 'strength'; } echo "You have successfully harvested your crop! You can now manage or use your drugs in the Drugs Owned section. [url='druglab.php'][b]Back[/b][/url]"; $db->query("INSERT INTO `drugsowned` VALUES('',".$iqr['fTYPE'].",".$_SESSION['userid'].",".$iqr['fquality'].",'$stat','".$iqr['drugTYPE']."',".$iqr['fQTY'].")"); $db->query("DELETE FROM `userfarm` WHERE `fID`=".$_GET['ID'].""); } function druguse() { global $it,$db,$h; $find = $db->query("SELECT `oID`,`oTYPE`,`oUSER`,`oQUALITY`,`oSTAT`,`oNAME`,`oQTY` FROM `drugsowned` WHERE `oUSER`=".$_SESSION['userid'].""); if(!$db->num_rows($find)) { echo "You do not currently hold any drugs that you can use. Please either purchase some or farm your own! [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } echo "<center><h2>Your Drugs</h2></center> [b][url='druglab.php']Back[/url][/b] <table width=100% class=ttable> <tr><th>Drug Name</th> <th>Drug Quantity</th> <th>Drug Quality</th> <th>Drug Stat</th> <th>Use</th> <th>Market Drug</th> <th>Send Drugs</th></tr>"; while($x=$db->fetch_row($find)) { echo "<tr><td>".stripslashes(htmlentities($x['oNAME']))."</td> <td>".number_format($x['oQTY'])."</td> <td>".number_format($x['oQUALITY'])."</td> <td>".stripslashes(htmlentities($x['oSTAT']))."</td> <td>[url='druglab.php?action=druguse2&ID=".$x[']<u>Use Drug</u>[/url]</td> <td>[url='druglab.php?action=market&ID=".$x[']<u>Add to Market</u>[/url]</td> <td>[url='druglab.php?action=usersend&ID=".$x[']<u>Send To User</u>[/url]</td></tr>"; } echo "</table>"; } function druguse2() { global $db,$it,$h; $find = $db->query("SELECT `oID`,`oTYPE`,`oUSER`,`oQUALITY`,`oSTAT`,`oNAME`,`oQTY` FROM `drugsowned` WHERE `oUSER`=".$_SESSION['userid']." AND `oID`=".$_GET['ID'].""); if(!$db->num_rows($find)) { echo "You do not currently hold any drugs that you can use. Please either purchase some or farm your own! [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $itd = $db->fetch_row($find); if(isset($_POST['submit']) && is_string($_POST['submit'])) { $userstats = $db->query("SELECT `strength`,`agility`,`guard` FROM `userstats` WHERE `userid`=".$_SESSION['userid'].""); if(!$db->num_rows($userstats)) { echo "An error has occured, please report this to administrator naming the location and what you were doing. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $itu = $db->fetch_row($userstats); $alreadyhigh = $db->query("SELECT `userid` FROM `oldstats` WHERE `userid`=".$_SESSION['userid'].""); if($db->num_rows($alreadyhigh)) { echo "You are already on a drug at this moment. Please wait for the effects of that drug to expire before attempting to use another one. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $db->query("INSERT INTO `oldstats` VALUES(".$_SESSION['userid'].",".$itu['strength'].",".$itu['agility'].",".$itu['guard'].")"); $updatecalc = $db->query("SELECT ".$itd['oSTAT']." FROM `userstats` WHERE `userid`=".$_SESSION['userid'].""); $sta=$db->fetch_row($updatecalc); $increase = ($sta[$itd['oSTAT']]/8)*$itd['oQUALITY']; $expires = $itd['oQUALITY']*5; $db->query("UPDATE `userstats` SET ".$itd['oSTAT']."=".$itd['oSTAT']."+$increase WHERE `userid`=".$_SESSION['userid'].""); $db->query("UPDATE `users` SET `expire`=$expires WHERE `userid`=".$_SESSION['userid'].""); $db->query("UPDATE `drugsowned` SET `oQTY`=`oQTY`-1 WHERE `oID`=".$_GET['ID'].""); $db->query("DELETE FROM `drugsowned` WHERE `oQTY`=0"); echo "After using ".stripslashes(htmlentities($itd['oNAME']))." You feel a high like you've never felt before and gain ".$increase." points to your ".stripslashes(htmlentities($itd['oSTAT']))." stat. This is only temporary so make use of it!"; } else { echo "You are about to use some ".stripslashes(htmlentities($itd['oNAME']))." which will give you a temporary bonus to your ".stripslashes(htmlentities($itd['oSTAT'])).". If you wish to continue, simply confirm below and enjoy, you will be notified when your high wears off. <form action = 'druglab.php?action=druguse2&ID=".abs((int) $_GET['ID'])."' method = 'post'> <input type = 'submit' value = 'Confirm' name = 'submit'> </form>"; } } function market() { global $db,$it,$h; if(!$_GET['ID']) { echo "You did not select a valid Drug ID.[url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $find = $db->query("SELECT `oID`,`oTYPE`,`oUSER`,`oQUALITY`,`oSTAT`,`oNAME`,`oQTY` FROM `drugsowned` WHERE `oUSER`=".$_SESSION['userid']." AND `oID`=".$_GET['ID'].""); if(!$db->num_rows($find)) { echo "Invalid Selection. Either this drug does not exist or it does not belong to you! [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $mydrug = $db->fetch_row($find); if($_POST['qty'] && $_POST['price']) { if($_POST['qty'] > $mydrug['oQTY']) { echo "You have attempted to place more on the market than you own. Please return and select a differant amount.[url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } echo "You have successfully added ".number_format($_POST['qty'])." units of ".stripslashes(htmlentities($mydrug['oNAME']))." to the market! [url='drugmarket.php'][b]View[/b][/url]"; $db->query("INSERT INTO `drugmarket` VALUES('',".$_POST['qty'].",".$_SESSION['userid'].",".$_POST['price'].",".$mydrug['oQUALITY'].",'".$mydrug['oNAME']."',".$mydrug['oTYPE'].",'".$mydrug['oSTAT']."')"); $db->query("UPDATE `drugsowned` SET `oQTY`=`oQTY`-".$_POST['qty']." WHERE `oID`=".$_GET['ID'].""); $db->query("DELETE FROM `drugsowned` WHERE `oQTY`=0"); } else { echo "You have selected to add some of your ".stripslashes(htmlentities($mydrug['oNAME']))." to the market. Please select a Quantity to add. <form action='druglab.php?action=market&ID=".$_GET['ID']."' method='post'> Amount to Add: <input type='text' name='qty' /> Price Requested: <input type='text' name='price'] /> <input type='submit' /> </form>"; } } function usersend() { global $db,$h,$it,$c; if(!$_GET['ID'] || $_GET['ID'] != abs((int) $_GET['ID'])) { echo "You did not select a valid drug ID.[b][url='druglab.php']Back[/url][/b]"; $h->endpage(); exit; } $find = $db->query("SELECT `oID`,`oTYPE`,`oUSER`,`oQUALITY`,`oSTAT`,`oNAME`,`oQTY` FROM `drugsowned` WHERE `oUSER`=".$_SESSION['userid']." AND `oID`=".$_GET['ID'].""); if(!$db->num_rows($find)) { echo "You do not currently hold any drugs that you can send to other users. Please either purchase some or farm your own! [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $dit = $db->fetch_row($find); if($_POST['user'] AND $_POST['amount']) { if($_POST['amount'] > $dit['oQTY']) { echo "You are trying to send more than you have.[b][url='druglab.php']Back[/url][/b]"; $h->endpage(); exit; } echo "You successfully sent ".number_format($_POST['amount'])." units of ".stripslashes(htmlentities($dit['oNAME']))." to User ID ".abs((int) $_POST['user'])." [url='druglab.php'][b]Back[/b][/url]"; $db->query("INSERT INTO `drugsowned` VALUES('',".abs((int) $dit['oTYPE']).",".abs((int) $_POST['user']).",".abs((int) $dit['oQUALITY']).",'".mysql_real_escape_string($dit['oSTAT'])."','".mysql_real_escape_string($dit['oNAME'])."',".abs((int) $_POST['amount']).")"); $db->query("UPDATE `drugsowned` SET `oQTY`=`oQTY`-".abs((int) $_POST['amount'])." WHERE (`oUSER`=".$_SESSION['userid'].")"); $db->query("DELETE FROM `drugsowned` WHERE (`oQTY` < 0)"); } else { echo "<form action='druglab.php?action=usersend&ID=".$_GET['ID']."' method='post'> User: ".user_dropdown($c,'user')." Amount: <input type='text' name='amount' value='0' /> <input type='submit' value='send drugs' /></form> Or Enter the users ID you wish to send to. <form action='druglab.php?action=usersend&ID=".$_GET['ID']."' method='post'> User: <input type='text' name='user' value='0' /> Amount: <input type='text' name='amount' value='0' /> <input type='submit' value='Send Drug' /></form>"; } } /* This Mod was Designed Free of Charge For the Members of Makewebgames.com Cronwerks.com MasterMccodes.com Dev-Forum.net Mcaddons.com This mod was solely designed and Developed by Immortal Thug. Modifications, Plug-ins, add-ons are Welcomed, But please keep the original Copyright Notice. Thanks to Zeddicus for baring with me on a few areas I got stuck on. Thanks to CrimeGame for a few security functions you will find below. Thanks to the members of Makewebgames.com for Throwing new Ideas my direction to add-on to this script. If you like this mod and would like to see more like it Please contact me at [email][email protected][/email] Thanks, and Enjoy. */ ?>
-
2nd bit Divided In Half due to size. druglab.php <?php /* This Mod was Designed Free of Charge For the Members of Makewebgames.com Cronwerks.com MasterMccodes.com Dev-Forum.net Mcaddons.com This mod was solely designed and Developed by Immortal Thug. Modifications, Plug-ins, add-ons are Welcomed, But please keep the original Copyright Notice. Thanks to Zeddicus for baring with me on a few areas I got stuck on. Thanks to CrimeGame for a few security functions you will find below. Thanks to the members of Makewebgames.com for Throwing new Ideas my direction to add-on to this script. If you like this mod and would like to see more like it Please contact me at [email][email protected][/email] Thanks, and Enjoy. */ require_once("globals.php"); // All Posts and Gets are Secured below. I find this easier than Securing them in each individual Query and I have tested to make sure they are secured. $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false; $_POST['amount'] = ( isset($_POST['amount']) AND ctype_digit($_POST['amount']) ) ? $_POST['amount'] : '' ; $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs((int) $_GET['ID']) : false; $_POST['drug'] = ( isset($_POST['drug']) AND ctype_digit($_POST['drug']) ) ? $_POST['drug'] : '' ; $_POST['damount'] = ( isset($_POST['damount']) AND ctype_digit($_POST['damount']) ) ? $_POST['damount'] : '' ; $_POST['qty'] = ( isset($_POST['qty']) AND ctype_digit($_POST['qty']) ) ? $_POST['qty'] : '' ; $_POST['price'] = ( isset($_POST['price']) AND ctype_digit($_POST['price']) ) ? $_POST['price'] : '' ; $_POST['user'] = ( isset($_POST['user']) AND ctype_digit($_POST['user']) ) ? $_POST['user'] : '' ; // End $_POST/$_GET security $itusers = $db->query("SELECT `userid`,`username`,`location`,`money` FROM `users` WHERE `userid`=".$_SESSION['userid'].""); if(!$db->num_rows($itusers)) { echo "You have encountered an error which should be reported to staff immediately!"; $h->endpage(); exit; } $it = $db->fetch_row($itusers); switch($_GET['action']) { case "index":index();break; case "druglist":druglist();break; case 'buydrug': buydrug(); break; case 'druggrow': druggrow(); break; case 'druggrow2': druggrow2(); break; case 'upkeep': upkeep(); break; case 'fertilize': fertilize(); break; case 'confirm': confirm(); break; case 'harvest': harvest(); break; case 'druguse': druguse(); break; case 'druguse2': druguse2(); break; case 'market': market(); break; case 'usersend': usersend(); break; default:index();break; } function index() { global $db; echo "<center><h2>Drug Lab Center</h2></center> <table width=80% class=ttable><tr><td>[url='druglab.php?action=druglist']Purchase Drugs[/url] </td><td>[url='druglab.php?action=druggrow']Grow Drugs[/url]</td></tr> <tr><td>[url='druglab.php?action=druguse']Drugs Owned[/url]</td> <td>[url='druglab.php?action=upkeep']Maintain Drugs[/url]</td></tr>"; } function druglist() { global $db,$it; $itdrugs = $db->query("SELECT `dID`,`drugTYPE`,`materialPRICE`,`drugCITY` FROM `drugs` WHERE `drugCITY`=".$it['location'].""); echo 'Welcome to the Drug Lab. <table width="95%" class="ttable"> <tr><th>Drug Type</th> <th>Material Cost</th> <th>Purchase</th></tr>'; while($itd=$db->fetch_row($itdrugs)) { echo '<tr><td>'.stripslashes(htmlentities($itd['drugTYPE'])).'</td><td>'.number_format($itd['materialPRICE']).'</td> <td>[url="druglab.php?action=buydrug&ID='.abs((int) $itd['dID']).'"]Purchase[/url]</td></tr>'; } echo '</table>'; echo ' [url="druglab.php"][b]Back[/b][/url]'; } function buydrug() { global $db,$h,$it; if(!$_GET['ID']) { echo "You did not select a valid drug ID."; $h->endpage(); exit; } $itdrugbuy = $db->query("SELECT `dID`,`drugTYPE`,`materialPRICE`,`drugCITY` FROM `drugs` WHERE `dID`=".$_GET['ID'].""); if(!$db->num_rows($itdrugbuy)) { echo 'This drug is not available.'; $h->endpage(); exit; } $cct = $db->fetch_row($itdrugbuy); if($_POST['amount']) { $xamount = $_POST['amount']*$cct['materialPRICE']; if($xamount > $it['money']) { echo 'You cannot afford this quantity. [url="druglab.php"][b]Back[/b][/url]'; $h->endpage(); exit; } else { $exists = $db->query("SELECT `type`,`usrID` FROM `materialsowned` WHERE `type`=".$cct['dID'].""); if($db->num_rows($exists)) { $db->query(sprintf("UPDATE `materialsowned` SET `qty`=`qty`+%u WHERE `usrID`=%d AND `type`=%u", abs((int) $_POST['amount']), $it['userid'], $cct['dID'])); $db->query(sprintf("UPDATE `users` SET `money`=`money`-%u WHERE `userid`=%d", abs((int) $xamount), $it['userid'])); echo "You have purchased ".number_format($_POST['amount'])." gram of ".stripslashes(htmlentities($cct['drugTYPE']))." supplies, at the price of ".abs((int) $xamount).". [url='druglab.php'][b]Back[/b][/url]"; } else { $db->query(sprintf("INSERT INTO `materialsowned` VALUES('',%u,'%s',%u,%d)", abs((int) $cct['dID']), mysql_real_escape_string($cct['drugTYPE']), $_POST['amount'], $it['userid'])); $db->query(sprintf("UPDATE `users` SET `money`=`money`-%u WHERE `userid`=%d", abs((int) $xamount), $it['userid'])); echo "You have purchased ".number_format($_POST['amount'])." gram of ".stripslashes(htmlentities($cct['drugTYPE']))." supplies, at the price of ".abs((int) $xamount).". [url='druglab.php'][b]Back[/b][/url]"; } } } else { echo "Current Price per Material: ".number_format($cct['materialPRICE'])." dollars cash. <form action='druglab.php?action=buydrug&ID=".$_GET['ID']."' method='post'> Enter Quantity: <input type='text' name='amount' /> <input type='submit' /> </form>"; } } function druggrow() { global $db,$h,$it; $drugsowned = $db->query("SELECT `type`,`typeNAME`,`qty`,`usrID` FROM `materialsowned` WHERE `usrID`=".$_SESSION['userid'].""); if(!$db->num_rows($drugsowned)) { echo "You do not own any drug materials. Please return to the lab to purchase the necessary items you would require. [b][url='druglab.php']Back[/url][/b]"; $h->endpage(); exit; } $dx = $db->fetch_row($drugsowned); if(isset($_POST['drug']) AND abs((int) $_POST['drug'])) { $drugsowned = $db->query("SELECT `type`,`typeNAME`,`qty`,`usrID` FROM `materialsowned` WHERE `usrID`=".$_SESSION['userid']." AND `type`=".$_POST['drug'].""); $bleh = $db->fetch_row($drugsowned); echo "Enter an Amount of the selected drug to send to the lab. You currently have ".number_format($bleh['qty'])." units of ".stripslashes(htmlentities($bleh['typeNAME']))." to farm. <form action='druglab.php?action=druggrow2&ID=".$_POST['drug']."' method='post'> Amount: <input type='text' name='damount' /> <input type='submit' /> </form>"; } else { echo '<center>Here you must select which drug you wish to grow for redistribution. </center. Various drugs will grow differantly in various cities. Please Select your type from the drop down menu to continue to the next step. <form action="druglab.php?action=druggrow" method="post"> <select name="drug" type="dropdown">'; $fetch = $db->query("SELECT d.`dID`,d.`drugTYPE`,m.`qty` FROM `drugs` d LEFT JOIN `materialsowned` m ON d.`dID`=m.`type` WHERE `usrID`=".$_SESSION['userid']." AND m.`qty`>0"); while($cc = $db->fetch_row($fetch)) { echo '<option value="'.abs((int) $cc['dID']).'">'.stripslashes(htmlentities($cc['drugTYPE'])).'</option>'; } echo '</select> <input type="submit" value="Select Drug"></form>'; } } function druggrow2() { global $db,$h; $itresult = $db->query("SELECT `type`,`typeNAME`,`qty` FROM `materialsowned` WHERE `usrID`=".$_SESSION['userid']." AND `type`=".$_GET['ID'].""); if(!$db->num_rows($itresult)) { echo "You do not have any seeds to plant here, please return to the drug lab and purchase some! [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $dait = $db->fetch_row($itresult); if($dait['type'] != $_GET['ID']) { echo "blah"; $h->endpage(); exit; } if($_POST['damount'] > $dait['qty']) { echo "You do not have this much to send to your lab, please select a differant amount. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } if(!$_POST['damount'] || $_POST['damount'] != abs((int) $_POST['damount'])) { echo "You did not select a quantity please return to the lab and try again. [url='druglab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } else { echo "You opted to send ".number_format($_POST['damount'])." unit(s) of ".stripslashes(htmlentities($dait['typeNAME']))." material to the lab to grow. [b][url='druglab.php'][b]Return[/b][/url]"; $db->query(sprintf("INSERT INTO `userfarm` VALUES('',0,%u,%u,1,1,%u)", $_POST['damount'], $_SESSION['userid'], $dait['type'])); $db->query(sprintf("UPDATE `materialsowned` SET `qty`=`qty`-%u WHERE `type`=%u AND `usrID`=%u AND `qty`>0", $_POST['damount'], $_GET['ID'], $_SESSION['userid'])); $db->query("DELETE FROM `materialsowned` WHERE `qty`=0"); $h->endpage(); exit; } } function upkeep() { global $db,$h; $growing = $db->query("SELECT uf.`fID`,uf.`age`,uf.`fQTY`,uf.`fuserid`,uf.`fquality`,uf.`ffertilized`,uf.`fTYPE`,d.`drugTYPE` FROM `userfarm` uf LEFT JOIN `drugs` d ON d.`dID`=uf.`fTYPE` WHERE `fuserid`=".$_SESSION['userid'].""); if(!$db->num_rows($growing)) { echo "You currently have no drugs growing in the lab. Please return to the materials depot to purchase the required items. [url='druglab.php'][b]Lab[/b][/url]"; $h->endpage(); exit; } echo "Below is a list of all drugs you currently have growing in the lab. Drug growing requires careful upkeep and proper fertilization. Please make sure your drugs are kept fertilized or they may turn out of poor quality Crops Take exactly 7 days to Harvest. Once harvested you have exactly One day to crop them or you will lose them. <table width=100% class=ttable> <tr> <th>Drug Name</th> <th>Amount Growing</th> <th>Quality</th> <th>Days Old</th> <th>Fertilize</th> <th>Harvest</th></tr>"; while($mm=$db->fetch_row($growing)) { echo "<tr> <td>".stripslashes(htmlentities($mm['drugTYPE']))."</td> <td>".number_format($mm['fQTY'])."</td> <td>".number_format($mm['fquality'])."</td> <td>".number_format($mm['age'])."</td>"; if($mm['ffertilized'] > 0) { echo "<td><font color=green>Doing Well</font></td>"; } else { echo "<td>[url='druglab.php?action=fertilize&ID=".$mm[']<u>Fertilize</u>[/url]</td>"; } if($mm['age'] > 6) { echo "<td>[url='druglab.php?action=harvest&ID=".$mm[']<u>Harvest</u>[/url]</td></tr>"; } else { echo "<td>Not Full Grown</td></tr>"; } } echo "</table> [url='druglab.php'][b]Return to Lab[/b][/url]"; }
-
Ok. Havent had to much time to test all aspects of this, but from the little testing I have done I have encountered no errors. If you find one, post it here and I'll fix it asap. Please note, this is the "base" design of this mod. There will be several larger add-ons in the future, some paid, some free. This mod is free to use, edit, add-on as you see fit, I only ask you keep the copyright on the modification itself. First I'll post the screenshots, then I'll post the code. Again, any problems, let me know asap as im the only one who made/tested it so to err is human :p SQL'S -- -------------------------------------------------------- -- -- Table structure for table `drugmarket` -- CREATE TABLE IF NOT EXISTS `drugmarket` ( `dID` int(11) NOT NULL auto_increment, `dQTY` int(11) NOT NULL, `dUSER` int(11) NOT NULL, `dPRICE` int(11) NOT NULL, `dquality` int(11) NOT NULL, `DRUG` varchar(255) NOT NULL, `type` int(11) NOT NULL, `stat` varchar(255) NOT NULL, PRIMARY KEY (`dID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -------------------------------------------------------- -- -- Table structure for table `drugs` -- CREATE TABLE IF NOT EXISTS `drugs` ( `dID` int(11) NOT NULL, `drugTYPE` varchar(255) NOT NULL, `materialPRICE` int(11) NOT NULL, `drugCITY` tinyint(3) NOT NULL, `fertilcost` int(11) NOT NULL, PRIMARY KEY (`dID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `drugs` -- INSERT INTO `drugs` (`dID`, `drugTYPE`, `materialPRICE`, `drugCITY`, `fertilcost`) VALUES (1, 'marijuana', 200, 1, 2000), (2, 'cocaine', 10000, 1, 10000), (3, 'PCP', 20000, 1, 25000); -- -- Table structure for table `drugsowned` -- CREATE TABLE IF NOT EXISTS `drugsowned` ( `oID` int(11) NOT NULL auto_increment, `oTYPE` int(11) NOT NULL, `oUSER` int(11) NOT NULL, `oQUALITY` int(11) NOT NULL, `oSTAT` varchar(255) NOT NULL, `oNAME` varchar(255) NOT NULL, `oQTY` int(11) NOT NULL, PRIMARY KEY (`oID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ; -- -- Table structure for table `userfarm` -- CREATE TABLE IF NOT EXISTS `userfarm` ( `fID` int(11) NOT NULL auto_increment, `age` tinyint(3) NOT NULL, `fQTY` int(11) NOT NULL, `fuserid` int(11) NOT NULL, `fquality` int(11) NOT NULL, `ffertilized` tinyint(3) NOT NULL, `fTYPE` int(11) NOT NULL, PRIMARY KEY (`fID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; CREATE TABLE IF NOT EXISTS `materialsowned` ( `uID` int(11) NOT NULL auto_increment, `type` int(11) NOT NULL, `typeNAME` varchar(255) NOT NULL, `qty` int(11) NOT NULL, `usrID` int(11) NOT NULL, PRIMARY KEY (`uID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; -- -------------------------------------------------------- -- -- Table structure for table `oldstats` -- CREATE TABLE IF NOT EXISTS `oldstats` ( `userid` int(11) NOT NULL auto_increment, `strength` decimal(11,4) NOT NULL, `agility` decimal(11,4) NOT NULL, `guard` decimal(11,4) NOT NULL, PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; ALTER TABLE `users` ADD expire int(11) NOT NULL; CRON add-ins. Cron_minute.php $db->query("UPDATE `users` SET `expire`=`expire`-1 WHERE `expire`>1"); $expired = $db->query("SELECT `userid`,`expire` FROM `users` WHERE `expire`=1"); while($ex=$db->fetch_row($expired)) { $findout = $db->query("SELECT `strength`,`agility`,`guard` FROM `oldstats` WHERE `userid`=".$ex['userid'].""); $update = $db->fetch_row($findout); $db->query("UPDATE `userstats` SET `agility`=".$update['agility'].",`strength`=".$update['strength'].",`guard`=".$update['guard']." WHERE `userid`=".$ex['userid'].""); $db->query("DELETE FROM `oldstats` WHERE `userid`=".$ex['userid'].""); $db->query("UPDATE `users` SET `expire`=0 WHERE `userid`=".$ex['userid'].""); } cron_day.php $db->query("UPDATE `userfarm` SET `ffertilized`=0 WHERE `ffertilized` !=0"); $db->query("UPDATE `userfarm` SET `age`=`age`+1 WHERE `age` < 8"); $db->query("DELETE FROM `userfarm` WHERE `age`>7"); drugmarket.php <?php /* This Mod was Designed Free of Charge For the Members of Makewebgames.com Cronwerks.com MasterMccodes.com Dev-Forum.net Mcaddons.com This mod was solely designed and Developed by Immortal Thug. Modifications, Plug-ins, add-ons are Welcomed, But please keep the original Copyright Notice. Thanks to Zeddicus for baring with me on a few areas I got stuck on. Thanks to CrimeGame for a few security functions you will find below. Thanks to the members of Makewebgames.com for Throwing new Ideas my direction to add-on to this script. If you like this mod and would like to see more like it Please contact me at [email][email protected][/email] Thanks, and Enjoy. */ require_once("globals.php"); $immortal = $db->query("SELECT `userid`,`username`,`money` FROM `users` WHERE (`userid`=".$_SESSION['userid'].")"); $it = $db->fetch_row($immortal); $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false; $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs((int) $_GET['ID']) : false; switch($_GET['action']) { case "dindex":index();break; case 'buy': buy(); break; case 'remove': remove(); break; default:dindex();break; } function dindex() { global $db,$h; $marketlist = $db->query("SELECT dm.`dID`,dm.`dQTY`,dm.`dUSER`,dm.`dPRICE`,dm.`dquality`,dm.`DRUG`,u.`username` FROM `drugmarket` dm LEFT JOIN `users` u ON dm.`dUSER`=u.`userid` ORDER BY `dPRICE` ASC"); if(!$db->num_rows($marketlist)) { echo "<table width=100% class=ttable><tr> <th>Owner</th> <th>Quality</th> <th>Single Price</th> <th>Total Price</th> <th>Quantity</th> <th>Buy</th> </tr> <tr> <td colspan=5>No Available Listings</td> </tr> </table>"; $h->endpage(); exit; } echo "<table width=100% class=ttable><tr> <th>Owner</th> <th>Drug</th> <th>Quality</th> <th>Single Price</th> <th>Total Price</th> <th>Quantity</th> <th>Buy</th> </tr>"; while($itd=$db->fetch_row($marketlist)) { $total = $itd['dPRICE']/$itd['dQTY']; echo "<tr> <td>".stripslashes(htmlentities($itd['username']))."</td> <td>".stripslashes(htmlentities($itd['DRUG']))."</td> <td>".number_format($itd['dquality'])."</td> <td>".number_format($total)."</td> <td>".number_format($itd['dPRICE'])."</td> <td>".number_format($itd['dQTY'])."</td>"; if($_SESSION['userid'] == $itd['dUSER']) { echo "<td>[url='drugmarket.php?action=remove&ID=".abs((int) $itd[']Remove[/url]</td>"; } else { echo "<td>[url='drugmarket.php?action=buy&ID=".abs((int) $itd[']Buy[/url]</td>"; } } echo "</table>"; } function buy() { global $db,$h,$it; if(!$_GET['ID']) { echo "You did not select a valid ID. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $exists = $db->query("SELECT `dID`,`dQTY`,`dUSER`,`dPRICE`,`dquality`,`DRUG`,`type`,`stat` FROM `drugmarket` WHERE (`dID`=".$_GET['ID'].")"); if(!$db->num_rows($exists)) { echo "The selection you requested has either been removed from the market or purchased by another user. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $its = $db->fetch_row($exists); if(!$it['money']) { echo "You have no cash on you! [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } if($_SESSION['userid'] == $its['dUSER']) { echo "Why would you try to purchase your own supply? [url='index.php'][b]Back</strong[/url]"; $h->endpage(); exit; } if($it['money'] < $its['dPRICE']) { echo "You cannot afford to complete this transaction. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } echo "You've successfully purchased ".number_format($its['dQTY'])." units of ".stripslashes(htmlentities($its['DRUG']))." at a price of ".number_format($its['dPRICE']).". [url='index.php'][b]Home[/b][/url]"; $db->query("UPDATE `users` SET `money`=`money`+".abs((int) $its['dPRICE'])." WHERE `userid`=".abs((int) $its['dUSER']).""); $db->query("UPDATE `users` SET `money`=`money`-".abs((int) $its['dPRICE'])." WHERE `userid`=".$_SESSION['userid'].""); $db->query("INSERT INTO `drugsowned` VALUES('',".abs((int) $its['type']).",".$_SESSION['userid'].",".abs((int) $its['dquality']).",'".mysql_real_escape_string($its['stat'])."','".mysql_real_escape_string($its['DRUG'])."',".abs((int) $its['dQTY']).")"); $db->query("DELETE FROM `drugmarket` WHERE `dID`=".$_GET['ID'].""); } function remove() { global $db,$h; if(!$_GET['ID']) { echo "You did not select a valid ID. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $exists = $db->query("SELECT `dID`,`dQTY`,`dUSER`,`dPRICE`,`dquality`,`DRUG`,`type`,`stat` FROM `drugmarket` WHERE (`dID`=".$_GET['ID'].")"); if(!$db->num_rows($exists)) { echo "The selection you requested has either been purchased by another user or does not exist. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $dd = $db->fetch_row($exists); if($_SESSION['userid'] != $dd['dUSER']) { echo "Only the owner of the item marketed can remove it from the market! [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } echo "Market listing has been successfully removed from the market and placed back into your Drug Inventory! "; $db->query("INSERT INTO `drugsowned` VALUES('',".abs((int) $dd['type']).",".$_SESSION['userid'].",".abs((int) $dd['dquality']).",'".mysql_real_escape_string($dd['stat'])."','".mysql_real_escape_string($dd['DRUG'])."',".abs((int) $dd['dQTY']).")"); $db->query("DELETE FROM `drugmarket` WHERE `dID`=".$_GET['ID'].""); } ?>
-
Most of this mod is going to be a free release, that I've seen nothing has been done of this "calibur" but if you find it point me to it and i'll point out the differances =P
-
I'm thinking about tacking on some form of addiction level that can / will have negative impacts...perhaps design a rehab facility in the future as well Havent decided 100% on all angles I'm going to take on this this is just the "start" of the mod :p
-
I've already coded that bit You take a drug you get a stat bonus. The length of the stat bonus depends on the quality of the drug. You cannot take another drug while on the current drug Once Drug wears off then you can take more :p
-
This one works off quality basis if you dont harvest these drugs on the 7th day you lose them forever and have to start over. Quality goes up with fertilization which will base on the stat gain you get if you successfully harvest There will be a police mod i'll be making as an add-on to this that will involve smugglings/user arrests etc, however as this will be a much larger plugin obviously it wont be free ^_- There will be a drug market, as well as the ability to send drugs to other users if one so chooses. few other features that arent shown above but i'm still "coding" the mod ;P
-
Ok so i've been working on this for the past few days, not quite done but will be. Just checking an interest level as it's going to be a free mod and wanted to show it off :P Drug Mod. Users will Purchase Materials to Grow drugs. The drugs will have to be Maintained. Fertilized daily. Once the age of the harvest reaches 7 days old the user will have to harvest the drugs Once Harvested the drugs become useable in a seperate table called Drugs Owned. Users can Use these drugs which will give temporary bonuses to differant Stats. Agility/strength/guard. There will be an option to sell these drugs or give these drugs to other users. The drugs will have differant Qualities, the quality decides how long the stat perk will last on the user as well as the amount they are worth. A few screenshots Few features still being made, any suggestions throw em at me :)
-
*whistles* :whistling: helps ^ Focused on this dang drug mod :P just slapped that together real quick ><
-
ALTER TABLE `users` ADD `race` enum('raceone','racetwo','racethree') NOT NULL default 'raceone'; in register.php under gender form box <th>Gender</th> <td colspan='2'> <select name='gender' type='dropdown'> <option value='Male'>Male <option value='Female'>Female</select> </td> </tr> add <th>Race</th> <td colspan='2'> <select name='race' type='dropdown'> <option value='raceone'>Race One</select> <option value='racetwo'>Race Two</select> <option value='racethree'>Race Three</select> </td> </tr> next find $db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES ( '{$username}', '{$loginname}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')"); after '$IP' add , {$_POST['race']} save / close /done. EDIT** small booboo '{$_POST['race']}'
-
Thumbz up n stuff
-
Problems Problems....I Have Tried I Swear..Please Help
Joshua replied to protek123's topic in General Discussion
so tired of seeing it >< -
I have a bit more advanced one for sale, the one you were referring to I beleive is done by sniko [V2] Class Benefits - Fighter || Traveller || Banker
-
Problems Problems....I Have Tried I Swear..Please Help
Joshua replied to protek123's topic in General Discussion
gah is everyone using that flippin layout >< -
would any1 like this in there game?
Joshua replied to corruptcity || skalman's topic in General Discussion
Hm, most odd. I'll stick with short and simple post = abs((int) it works for me 100% of the time >,< -
would any1 like this in there game?
Joshua replied to corruptcity || skalman's topic in General Discussion
I'm not 100% sure either Originally to test I told him to use $_POST['blah'] = abs((int) $_POST['blah']) but with simple -999999999999999 or +99999999999999999999- was slipping through so i dno. -
would any1 like this in there game?
Joshua replied to corruptcity || skalman's topic in General Discussion
lol no one can demo the mod as your site registration is being broken >,< -
would any1 like this in there game?
Joshua replied to corruptcity || skalman's topic in General Discussion
lemme know if you want me to hammer it before you release it ;) -
mccode-v2 Updated Newspaper - more than one page
Joshua replied to Magictallguy's topic in Free Modifications
rofl rofl rofl -
.'"]Rent A Spy
-
what was the error :\ Also helps to post 2-3 lines of code above and or below ;-)