Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Can't find exactly what you've been wanting? Try searching for what you are looking for in the search box to the right. ----------->


This forum is now closed and has moved to a new location! Click here to find out why.
Pages: [1] 2

AuthorTopic: Elite Drug Mod  (Read 1726 times)

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Elite Drug Mod
« on: February 25, 2010, 07:51:57 PM »
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

Code: [Select]



-- --------------------------------------------------------

--
-- 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



Code: [Select]
$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
Code: [Select]
$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
Code: [Select]
<?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 
joshuawdams@hotmail.com
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><a href='drugmarket.php?action=remove&ID=".abs((int) $itd['dID'])."'>Remove</a></td>";
                                    }
                               else
                                     { 
                                    echo 
"<td><a href='drugmarket.php?action=buy&ID=".abs((int) $itd['dID'])."'>Buy</a></td>";
 }
}
echo 
"</table>";
                                 
                                         
}
     function 
buy()
{
     global 
$db,$h,$it;
if(!
$_GET['ID'])
     {
echo 
"You did not select a valid ID.<br /><a href='index.php'><strong>Back</strong></a>";
     
$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.<br /><a href='index.php'><strong>Back</strong></a>";
$h->endpage();
     exit;
}
     
$its $db->fetch_row($exists);

if(!
$it['money'])
     {
echo 
"You have no cash on you!<br /><a href='index.php'><strong>Back</strong></a>";
     
$h->endpage();
exit;
     }

if(
$_SESSION['userid'] == $its['dUSER'])
     {
echo 
"Why would you try to purchase your own supply?<br /><a href='index.php'><strong>Back</strong</a>";
     
$h->endpage();
exit;
     }
if(
$it['money'] < $its['dPRICE'])
     {
echo 
"You cannot afford to complete this transaction.<br /><a href='index.php'><strong>Back</strong></a>";
     
$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']).".<br /><a href='index.php'><strong>Home</strong></a>";
     
$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.<br /><a href='index.php'><strong>Back</strong></a>";
     
$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.<br /><a href='index.php'><strong>Back</strong></a>";
$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!<br /><a href='index.php'><strong>Back</strong></a>";
$h->endpage();
exit;
}

echo 
"Market listing has been successfully removed from the market and placed back into your Drug Inventory!<br />";
$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']."");




}
?>

« Last Edit: February 26, 2010, 11:44:35 AM by Immortalthug »
Logged

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: Elite Drug Mod
« Reply #1 on: February 25, 2010, 07:53:25 PM »

druglab.php
Code: [Select]
<?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 
joshuawdams@hotmail.com
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><br />
      <table width=80% class=ttable><tr><td><a href='druglab.php?action=druglist'>Purchase Drugs</a>
                                        </td><td><a href='druglab.php?action=druggrow'>Grow Drugs</a></td></tr>
                                         <tr><td><a href='druglab.php?action=druguse'>Drugs Owned</a></td> 
                                             <td><a href='druglab.php?action=upkeep'>Maintain Drugs</a></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.<br />
         <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><a href="druglab.php?action=buydrug&ID='
.abs((int) $itd['dID']).'">Purchase</a></td></tr>';
}
echo 
'</table>';
echo 
'<br /><a href="druglab.php"><strong>Back</strong></a>';
}
   function 
buydrug()  
 {
   global 
$db,$h,$it;

$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.<br /><a href="druglab.php"><strong>Back</strong></a>';
$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).".<br /><a href='druglab.php'><strong>Back</strong></a>";
}
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).".<br /><a href='druglab.php'><strong>Back</strong></a>";

}
}
}
else
{
echo 
"Current Price per Material: ".number_format($cct['materialPRICE'])." dollars cash.<br />
     <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.<br /><strong><a href='druglab.php'>Back</a></strong>";
$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.<br />
     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.<br /></center.
    Various drugs will grow differantly in various cities.<br />
    Please Select your type from the drop down menu to continue to the next step.<br />
    <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><br>
    <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!<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br />
      <strong><a href='druglab.php'><strong>Return</strong></a>"
;
$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.<br /><a href='druglab.php'><strong>Lab</strong></a>";
$h->endpage();
exit;
}
                            echo 
"Below is a list of all drugs you currently have growing in the lab.<br />
                                  Drug growing requires careful upkeep and proper fertilization.<br />
                                  Please make sure your drugs are kept fertilized or they may turn out of poor quality<br />
                                  Crops Take exactly 7 days to Harvest.  Once harvested you have exactly One day to crop them or you will lose them.<br />
                                  <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><a href='druglab.php?action=fertilize&ID=".$mm['fID']."'><u>Fertilize</u></a></td>";
}
if(
$mm['age'] > 6)
{
                             echo 
"<td><a href='druglab.php?action=harvest&ID=".$mm['fID']."'><u>Harvest</u></a></td></tr>";
}
else
{
                             echo 
"<td>Not Full Grown</td></tr>";
}
}
echo 
"</table><br />
              <a href='druglab.php'><strong>Return to Lab</strong></a>"
;
}
 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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br />
<center><a href='druglab.php?action=confirm&ID="
.$_GET['ID']."'><u><strong>I hereby confirm purchase.</strong></u></a> ";
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$h->endpage();
exit;
}
if(
$itd['ffertilized'] > 0)
{
echo 
"You have alreay fertilized this batch today.  You do not want to over kill it! <br />
      Please come back tomorrow and try again.<br /><a href='druglab.php'><strong>Back</strong></a>"
;
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$h->endpage();
exit;
}
else
{
echo 
"You have successfully fertilized this batch of drugs! Click below to return to your management center.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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!<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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!<br /><a href='druglab.php'><strong>Back</strong></a>";
$h->endpage();
exit;
}
echo 
"<center><h2>Your Drugs</h2></center><br /><strong><a href='druglab.php'>Back</a></strong>
              <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><a href='druglab.php?action=druguse2&ID="
.$x['oID']."'><u>Use Drug</u></a></td>
          <td><a href='druglab.php?action=market&ID="
.$x['oID']."'><u>Add to Market</u></a></td>
          <td><a href='druglab.php?action=usersend&ID="
.$x['oID']."'><u>Send To User</u></a></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!<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<br /><a href='index.php'><strong>Back</strong></a>";
   
$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.<br /><a href='druglab.php'><strong>Back</strong></a>";
$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'])).".<br />
        If you wish to continue, simply confirm below and enjoy, you will be notified when your high wears off.<br />
        <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.<a href='druglab.php'><strong>Back</strong></a>";
   
$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!<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<a href='druglab.php'><strong>Back</strong></a>";
$h->endpage();
exit;
}

echo 
"You have successfully added ".number_format($_POST['qty'])." units of ".stripslashes(htmlentities($mydrug['oNAME']))." to the market!
      <a href='drugmarket.php'><strong>View</strong></a>"
;
$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.<br />
      <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.<strong><a href='druglab.php'>Back</a></strong>";
$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!<br /><a href='druglab.php'><strong>Back</strong></a>";
$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.<strong><a href='druglab.php'>Back</a></strong>";
$h->endpage();
exit;
}
echo 
"You successfully sent ".number_format($_POST['amount'])." units of ".stripslashes(htmlentities($dit['oNAME']))." to User ID ".abs((int) $_POST['user'])."
     <a href='druglab.php'><strong>Back</strong></a>"
;
$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')."<br />
      Amount: <input type='text' name='amount' value='0' /><br />
      <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' /><br />
      Amount: <input type='text' name='amount' value='0' /><br />
      <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 
joshuawdams@hotmail.com
Thanks, and Enjoy.
*/
?>

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: Elite Drug Mod
« Reply #2 on: February 26, 2010, 11:20:44 AM »
Sorry Folks, there was a very small BooBoo in the cron, it's been fixed and updated in original post.

xTRUTECHNIQUEx

  • Basic Member
  • *
  • Reputation Power: 13
  • xTRUTECHNIQUEx has no influence.
  • Offline Offline
  • Posts: 4
    • View Profile
    • Email
Re: Elite Drug Mod
« Reply #3 on: March 31, 2010, 09:15:42 AM »
I have a few small issues, likely on my end.

1 on the main druglab page it's like the endpage function is missing, I added it to the end and fixed everything but the main page.

And the 2nd problem is with the crons, for some reason it doesn't count the days. Stay at 0 days old when growing drugs.

Here's my whole day cron file.

Code: [Select]
<?php
include "config.php";
global 
$_CONFIG;
if(
$_GET['code'] != $_CONFIG['code']) { die(""); }
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;
$db->query("UPDATE fedjail set fed_days=fed_days-1");
$q=$db->query("SELECT * FROM fedjail WHERE fed_days=0");
$ids=array();
while(
$r=$db->fetch_row($q))
{
$ids[]=$r['fed_userid'];
}
if(
count($ids) > 0)
{
$db->query("UPDATE users SET fedjail=0 WHERE userid IN(".implode(","$ids).")");
}
$db->query("DELETE FROM fedjail WHERE fed_days=0");
$db->query("UPDATE users SET daysingang=daysingang+1 WHERE gang > 0");
$db->query("UPDATE users SET daysold=daysold+1, boxes_opened=0");
$db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0");
$db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0");
$db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0");
$db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0");
$db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*3) where cybermoney>0");
$db->query("UPDATE users SET turns=25");
$q=$db->query("SELECT * FROM users WHERE cdays=0 AND course >0");
while(
$r=$db->fetch_row($q))
{
$cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}");
$coud=$db->fetch_row($cd);
$userid=$r['userid'];
$db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r['course']})");
$upd="";
$ev="";
if(
$coud['crSTR'] > 0)
{
$upd.=",us.strength=us.strength+{$coud['crSTR']}";
$ev.=", {$coud['crSTR']} strength";
}
if(
$coud['crGUARD'] > 0)
{
$upd.=",us.guard=us.guard+{$coud['crGUARD']}";
$ev.=", {$coud['crGUARD']} guard";
}
if(
$coud['crLABOUR'] > 0)
{
$upd.=",us.labour=us.labour+{$coud['crLABOUR']}";
$ev.=", {$coud['crLABOUR']} labour";
}
if(
$coud['crAGIL'] > 0)
{
$upd.=",us.agility=us.agility+{$coud['crAGIL']}";
$ev.=", {$coud['crAGIL']} agility";
}
if(
$coud['crIQ'] > 0)
{
$upd.=",us.IQ=us.IQ+{$coud['crIQ']}";
$ev.=", {$coud['crIQ']} IQ";
}
$ev=substr($ev,1);
if (
$upd) {
$db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid");
}
$db->query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'Congratulations, you completed the {$coud['crNAME']} and gained $ev!')");
$db->query("UPDATE users SET new_events=new_events+1 WHERE userid={$userid}");
}
$db->query("UPDATE users SET course=0 WHERE cdays=0");

$db->query("UPDATE users SET cannabisDays=cannabisDays-1 WHERE cannabisDays > 0");
$db->query("UPDATE users SET cocaineDays=cocaineDays-1 WHERE cocaineDays > 0");
$db->query("UPDATE users SET mmDays=mmDays-1 WHERE mmDays > 0");
$db->query("UPDATE users SET heroinDays=heroinDays-1 WHERE heroinDays > 0");
$db->query("UPDATE users SET mm=0 WHERE mmDays=0");
$db->query("UPDATE users SET heroin=0 WHERE heroinDays=0");
$db->query("UPDATE users SET cocaine=0 WHERE cocaineDays=0");
$db->query("UPDATE users SET cannabis=0 WHERE cannabisDays=0");
$q $db->query("SELECT * FROM users");
$ir $db->fetch_row($q);
$query $db->query("SELECT * FROM drugsell");
$sell $db->fetch_row($query);
$rand rand(800,2000);
$db->query("UPDATE drugsell SET cannabis=$rand");
$rand2 rand(1800,3000);
$db->query("UPDATE drugsell SET cocaine=$rand2");
$rand3 rand(2000,3200);
$db->query("UPDATE drugsell SET mm=$rand3");
$rand4 rand(2800,4200);
$db->query("UPDATE drugsell SET heroin=$rand4");
if (
$ir['ca'] == 'y' && $ir['cannabisDays'] == 0)
{
$db->query("UPDATE users SET money=money+{$sell['cannabis']} WHERE ca='y'");
$db->query("UPDATE users SET ca='n' WHERE ca='y'");
}
if (
$ir['co'] == 'y' && $ir['cocaineDays'] == 0)
{
$db->query("UPDATE users SET money=money+{$sell['cocaine']} WHERE co='y'");
$db->query("UPDATE users SET co='n' WHERE co='y'");
}
if (
$ir['h'] == 'y' && $ir['heroinDays'] == 0)
{
$db->query("UPDATE users SET money=money+{$sell['heroin']} WHERE h='y'");
$db->query("UPDATE users SET h='n' WHERE h='y'");
}
if (
$ir['m'] == 'y' && $ir['mmDays'] == 0)
{
$db->query("UPDATE users SET money=money+{$sell['mm']} WHERE m='y'");
$db->query("UPDATE users SET m='n' WHERE m='y'");
}
$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");
}
$db->query("INSERT INTO announcements VALUES ('<h3>Last Drug Sell Rates</h3><br /><br />

<table border=1><tr><td>Cannabis</td><td>{$sell['cannabis']}</td></tr>

<tr><td>Cocaine</td><td>{$sell['cocaine']}</td></tr>

<tr><td>Magic Mushrooms</td><td>{$sell['mm']}</td></tr>

<tr><td>Heroin</td><td>{$sell['heroin']}</td></tr>
</table>', UNIX_TIMESTAMP()) "
);
;

?>






Logged

Zeddicus

  • Basic Member
  • *
  • Reputation Power: 0
  • Zeddicus is looked down upon.Zeddicus is looked down upon.
  • Offline Offline
  • Posts: 42
    • View Profile
    • WWW
Re: Elite Drug Mod
« Reply #4 on: April 17, 2010, 03:53:15 AM »
If ya want to get hold of him go here... http://maketextgames.com -- It's his forum.
Logged

MoAZeR

  • Basic Member
  • *
  • Reputation Power: 12
  • MoAZeR has no influence.
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Elite Drug Mod
« Reply #5 on: May 11, 2010, 09:52:09 AM »
I get this error

Code: [Select]
QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Query was SELECT `dID`,`drugTYPE`,`materialPRICE`,`drugCITY` FROM `drugs` WHERE `dID`=

In druglab.php

Can someone help me fix it i tried but i have no idea why its not working.

Regards,
Adrian
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Elite Drug Mod
« Reply #6 on: May 11, 2010, 11:32:10 AM »
Theres no ID input
Logged
Project Choosen - 10%
Daniel - Hanson . Com

DJShad

  • Basic Member
  • *
  • Reputation Power: 20
  • DJShad has no influence.
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Elite Drug Mod
« Reply #7 on: November 24, 2010, 01:55:00 AM »
hey i know its been a while for this post clearly...but i want to try this mod on my site but when i run the sql i keep getting this error message

Error
SQL query:

-- --------------------------------------------------------
--
-- 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;

MySQL said:

#1046 - No database selected


im not sure what to do its my first time ever trying something like this possibly you can tell me what im doing wrong
Logged

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: Elite Drug Mod
« Reply #8 on: November 30, 2010, 04:19:09 PM »
No database selected, where are you trying to install this?

more so how?

dominion

  • Active Member
  • **
  • Reputation Power: 89
  • dominion barely matters.dominion barely matters.
  • Offline Offline
  • Posts: 129
    • View Profile
    • Email
Re: Elite Drug Mod
« Reply #9 on: December 01, 2010, 06:51:55 AM »
When you go into phpmyadmin (i assume that is what you're using) make sure you click your database name on the side menu and all your tables are listed there. Then go into the sql tab, and use copy and paste.
Logged

DJShad

  • Basic Member
  • *
  • Reputation Power: 20
  • DJShad has no influence.
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Elite Drug Mod
« Reply #10 on: December 01, 2010, 12:05:18 PM »
Ok i got it thanks to dominion thank you so muc now im going to try to do the other steps lol

{EDIT}

do i create a new file called Cron_minute.php, cron_day.php and drugmarket.php myself? and would i have to set up new crons for my site as well?

another question is that you have the c on Cron_minute.php as C is it supposed to be C or c or does it matter at all

im sorry for asking so many questions and such im still trying to learn and trust me im going to learn this all and soon ill be making my own mods as soon as i get further experience hehe

« Last Edit: December 01, 2010, 12:24:18 PM by DJShad »
Logged

DJShad

  • Basic Member
  • *
  • Reputation Power: 20
  • DJShad has no influence.
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Elite Drug Mod
« Reply #11 on: December 01, 2010, 12:39:58 PM »
hey sorry for posting so much but how would i make it so that users can get to the drug lab?

when i go to the direct link http://the-wicked-realms.com/druglab.php it tells me to purchase drugs...but when i click it i get this message...

QUERY ERROR:
Query was SELECT `dID`,`drugTYPE`,`materialPRICE`,`drugCITY` FROM `drugs` WHERE `dID`=

What should i do?
Logged

dominion

  • Active Member
  • **
  • Reputation Power: 89
  • dominion barely matters.dominion barely matters.
  • Offline Offline
  • Posts: 129
    • View Profile
    • Email
Re: Elite Drug Mod
« Reply #12 on: December 01, 2010, 12:43:24 PM »
I like the fact you're asking stuff. It's a nice change from "can you do it for me"  ;)
Anyway...
Quote
do i create a new file called Cron_minute.php, cron_day.php and drugmarket.php myself? and would i have to set up new crons for my site as well?
drugmarket.php + druglab.php yes, you make the files. crons no, Just add whats there to the crons you already have.
$c is the connection identifier so use whatever you have defined. in mcc it is "$c" tho if you're using v2, and using $db->query the class file adds it in for you.
EDIT - look up in the topic danny posted an answer to someone else with the same error.
« Last Edit: December 01, 2010, 12:46:06 PM by dominion »
Logged

DJShad

  • Basic Member
  • *
  • Reputation Power: 20
  • DJShad has no influence.
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Elite Drug Mod
« Reply #13 on: December 03, 2010, 05:19:01 PM »
i have v2 of mcc and such but it didnt add it in at all the website is http://the-wicked-realms.com

as to the topic danny posted all i see for and answer is there is no ID Input my question now would be...How would i put in the ID Input?

Thank you for your help in advance i know you really dont have time for noobs but it sure helps out alot :)
Logged

DJShad

  • Basic Member
  • *
  • Reputation Power: 20
  • DJShad has no influence.
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Elite Drug Mod
« Reply #14 on: December 09, 2010, 04:16:48 PM »
ok i know i keep asking this question...but is anyone else getting this message

Code: [Select]
QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Query was SELECT `dID`,`drugTYPE`,`materialPRICE`,`drugCITY` FROM `drugs` WHERE `dID`=

i get it when i try to purchase any drug.

i have looked all through the code to see if everything matched i have done everything here...what do i do? please dont give me an answer such as "look at dannys post" or that "no ID input" what i need to know is how do i fix this..why is this coming up? please help me


Thanks
Shad
« Last Edit: December 09, 2010, 11:27:17 PM by DJShad »
Logged
Pages: [1] 2
« previous next »
 


This forum is now closed and has moved to a new location! Click here to find out why.