Jump to content
xisto Community
Sign in to follow this  
Variablez

Mccodes V2, Another Mod Of Mine! Drug Corner

Recommended Posts

Hey all! In this tutorial, I will show you how to make your very own McCodes Drug Corner! NOTE THIS IS NOT MY WORK!:


Okay so make a new page on your site and call it "DRUGS.PHP"

DRUGS.PHP:

<?php/*------------------------------------------------------- Blown City-- A product of GoldenZero.Net-- Copyright held 2007 by GoldenZero-- E-mail: joshisthebest1ca[AT]msn[DOT]com-----------------------------------------------------*/include "globals.php";$_GET['ID']= abs((int) $_GET['ID']);print "<h2>{$set['game_name']} Drug Corner</h2>";switch($_GET['action']){case "buy":buy();break;default:index();break;}function index(){global $db;print "<br>You walk along the {$set['game_name']} streets and see a bunch of people hanging out in a corner near the shops, you walk over to see the guy in charge, he asks you if you need any drugs, you tell him your interested and he shows you.<br><br><table class='table' border='0' width='60%'><tr><th>Dealer</th><th>Drug Name</th><th>Price</th><th>Drugs Left</th><th>Buy</th></tr>";$drugies=$db->query("SELECT * FROM drugs");while($drugies=$db->fetch_row($$drugies)){print "<tr><td>{$drugies['dNAME']}</td><td>{$drugies['dDRUG']}</td><td>\${$drugies['dPRICE']}</td>";if($drugies['dQTY'] == 0){$qty="None!";}else{$qty="{$drugies['dQTY']}";}print "<td>{$qty}</td><td><a href='drugs.php?action=buy&ID={$drugies['dID']}'>Buy</a></td></tr>";}print "</table>";}function buy(){global $db,$userid,$ir;print "<h4>Buying Drug</h4>";$_GET['ID']= abs((int) $_GET['ID']);if(!$_GET['ID']){print "Not buying a drug??";}if(!$_GET['ID']){print "Invalid use of file";}$aq=$db->query("SELECT * FROM drugs WHERE dID={$_GET['ID']}");if($db->num_rows($aq) == 0){print "Invalid drug ID";}$drugies=$db->query("SELECT * FROM drugs WHERE dID={$_GET['ID']}");$drugies=$db->fetch_row($$drugies);$price=$drugies['dPRICE'];$will=$drugies['will'];$energy=$drugies['energy'];$brave=$drugies['brave'];$hp=$drugies['health'];if($drugies['dQTY'] == 0){die("{$drugies['dNAME']} is out of {$drugies['dDRUG']}!");}if($ir['money'] < $price){die("You dont have enough money to buy {$drugies['dDRUG']} off {$drugies['dNAME']}!");}$db->query("UPDATE users SET money=money-$price,energy=energy+{$energy},brave=brave+{$brave},hp=hp+{$hp},will=will+{$will} WHERE userid=$userid");$db->query("UPDATE users SET will=maxwill WHERE will > maxwill");$db->query("UPDATE users SET energy=maxenergy WHERE energy > maxenergy");$db->query("UPDATE users SET brave=maxbrave WHERE brave > maxbrave");$db->query("UPDATE users SET hp=maxhp WHERE hp > maxhp");$db->query("UPDATE drugs SET dQTY=dQTY-1 WHERE dID={$drugies['dID']}");echo str_replace('$name', $drugies['dNAME'], $drugies['dEFFECT']); print "<br><br><a href='drugs.php'>Back</a>";}$h->endpage();?>


Now you have done that, we must get down to the SQL bit, this is an important bit because it includes ALL of the data!

MY SQL BIT:

Open up PHP MY ADMIN and run this query:

CREATE TABLE `drugs` (
 `dID` int(11) NOT NULL auto_increment,
 `dNAME` varchar(255) NOT NULL default 'Some Guy',
 `dSEX` varchar(3) NOT NULL default 'him',
 `dDRUG` varchar(255) NOT NULL default 'Some Drug',
 `dEFFECT` text NOT NULL,
 `energy` int(11) NOT NULL default '0',
 `will` int(11) NOT NULL default '0',
 `brave` int(11) NOT NULL default '0',
 `health` int(11) NOT NULL default '0',
 `dPRICE` int(11) NOT NULL default '0',
 `dQTY` int(11) NOT NULL default '0',
 `dOD` int(11) NOT NULL default '0',
 PRIMARY KEY  (`dID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

INSERT INTO `drugs` VALUES (1, 'Josh', 'him', 'Weed', 'You light up the weed with your lighter and start taking big puffs, you pass it to $name and pass back and forth for a few minutes then you walk home. While walking home you feel all happy and braver, all you want to do is do some illegal activity.', 10, 10, 2, 10, 100, "CHANGE THIS NUMBER TO WHAT AMOUNT YOU WANT", 0);
INSERT INTO `drugs` VALUES (2, 'John', 'him', 'Hash', 'You start lighting up the hash in your hash pipe with your lighter and start taking big puffs, you pass it to $name and pass back and forth for a few minutes then you walk home. While walking home you feel all happy and braver, all you want to do is do some illegal activity.', 20, 20, 4, 20, 200, "CHANGE THIS NUMBER TO WHAT AMOUNT YOU WANT", 0);
INSERT INTO `drugs` VALUES (3, 'Jay', 'him', 'Shrooms', 'You start eating the shrooms with $name, you start seeings some crazy stuff in the alleys so you tell $name your going to head home, befor you left you ate the rest of the shrooms. While walking home you feel all happy and braver, all you want to do is do some illegal activity.', 30, 30, 6, 30, 300, "CHANGE THIS NUMBER TO WHAT AMOUNT YOU WANT", 0);


Note the bit where it says change this number to the amount you want, change it to something reasonably big because they dont update...

Thanks, Hope you enjoyed and good luck

Notice from jhaslip:

Code tags added.
Use them when you post code snippets, especially snippets that are not written by yourself, as per the Xisto readme

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.