Magictallguy Posted April 10, 2009 Posted April 10, 2009 Re: I need help with a Mod i made What the hell..................This script is more jacked up than the mccodes forums.php.... You where debating on selling this?? lol You no longer need to worry about the MC Craps version, use mne! :P Quote
AlabamaHit Posted April 10, 2009 Posted April 10, 2009 Re: I need help with a Mod i made lol, naw I'll use mine :-P Quote
Danny696 Posted April 10, 2009 Author Posted April 10, 2009 Re: I need help with a Mod i made i was trying to make a leveled streets if anyone could make one and post it i could learn from wat you have done :-D Quote
seanybob Posted April 10, 2009 Posted April 10, 2009 Re: I need help with a Mod i made What the hell..................This script is more jacked up than the mccodes forums.php.... You where debating on selling this?? lol You no longer need to worry about the MC Craps version, use mne! :P Hahaha Just yesterday I had a guy ask me to check your 'secure forums' that he installed on his site. Within 2 minutes I had access to the head admin's account. Quote
Danny696 Posted April 10, 2009 Author Posted April 10, 2009 Re: I need help with a Mod i made lmao any help with the leveld streets Quote
yaz123 Posted April 10, 2009 Posted April 10, 2009 Re: I need help with a Mod i made man.....come on lol $db->query("UPDATE users SET turns = turns - 1 WHERE userid = ".$userid.""); $sql = sprintf("UPDATE users SET turns = turns - 1 WHERE (userid = %u)", $userid); $db->query($sql); That should work :) Quote
yaz123 Posted April 10, 2009 Posted April 10, 2009 Re: I need help with a Mod i made hey man dont blame me im 13 and have learnt some php from reading php so when i spent over 2 hours coding i think im gonna make some mistakes dont u :oops: :cry: and i only made 2 mistakes :-P You should learn how to code PHP before you own a game Quote
POG1 Posted April 10, 2009 Posted April 10, 2009 Re: I need help with a Mod i made I don't understand your logic... You 'spent' 2 hours 'creating' your mod yet you cannot find 2 simple syntax errors which you would find/fix as you go along, are you sure you even created this? :? Quote
AlabamaHit Posted April 10, 2009 Posted April 10, 2009 Re: I need help with a Mod i made No you didn't "make" it. I can tell by looking at it. That it is a combinatino of mine and streets....well, at least an attempt to. Quote
Magictallguy Posted April 11, 2009 Posted April 11, 2009 Re: I need help with a Mod i made What the hell..................This script is more jacked up than the mccodes forums.php.... You where debating on selling this?? lol You no longer need to worry about the MC Craps version, use mne! :P Hahaha Just yesterday I had a guy ask me to check your 'secure forums' that he installed on his site. Within 2 minutes I had access to the head admin's account. That can't be right O.o I'll look into it some more.. Quote
Danny696 Posted April 11, 2009 Author Posted April 11, 2009 Re: I need help with a Mod i made hey man dont blame me im 13 and have learnt some php from reading php so when i spent over 2 hours coding i think im gonna make some mistakes dont u :oops: :cry: and i only made 2 mistakes :-P You should learn how to code PHP before you own a game im not makeing a game i just tried to make this for a game Quote
Danny696 Posted April 15, 2009 Author Posted April 15, 2009 Re: I need help with a Mod i made on a different fourm madgictallguy edited/re-made it for me heres th codes: <?php include(DIRNAME(__FILE__) . '/globals.php'); if($ir['jail']) { echo "<div align='center'>You see some bins outside your cell and you remember where they are so you can visit when you get out of [b]Jail[/b]</div>"; echo "<div align='center'>Go Back To <a href='jail.php'>Jail</div>"; $h->endpage(); exit; } if($ir['hospital']) { echo "<div align='center'>You see a bin next to you bed and start to look in it then the nurse comes in and sedates you</div>"; echo "<div align='center'>Go Back To <a href='hospital.php'>Hospital</div>"; $h->endpage(); exit; } if(!$ir['turns']) { echo "You do not have enough steps to scavenge the streets any more. Come back at newday. "; $h->endpage(); exit; } $expgained = (mt_rand(20,90) * $ir['street_level']); $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : ""; switch($_GET['action']) { case 'street1' : street_1(); break; case 'street2' : street_2(); break; case 'street3' : street_3(); break; case 'street4' : street_4(); break; case 'street5' : street_5(); break; default : street_index(); break; } function street_index() { global $ir, $userid; $min_perc = ($ir['street_exp'] / $ir['street_needed'] * 100); echo "<div style='text-align:center;'>You are currently scavenging the streets. You can find everything here from money and crystals, to items and experience "; echo sprintf("Your street level is %s and you have %s/%s (%s%%) mining experience", number_format($ir['street_level']), number_format($ir['street_exp']), number_format($ir['street_needed']), $min_perc); echo "</div>"; echo "<div align='center'> <u>Street Levels</u> [[url='streets.php?action=street1']Level 1 streets[/url]] [[url='streets.php?action=street2']Level 10 streets[/url]] [[url='streets.php?action=street3']Level 20 streets[/url]] [[url='streets.php?action=street4']Level 30 streets[/url]] [[url='streets.php?action=street5']Level 40 streets[/url]] "; } function street_1() { global $ir, $db, $userid; $chance = mt_rand(1,3); if($chance == 1) { $amnt = mt_rand(50,200); if($ir['money'] > $amnt) { echo sprintf("As you scavenge the streets you see a hobo; he asks you for \$%u and you tell him to piss off. Then he proceeds to smack the cr*p out of you. He takes the \$%s anyway. ", $amnt, $amnt); takecash($amnt); $ir['money'] -= $amnt; } else { echo "As you walk the streets you see a hobo he asks you for \$1. You tell him to piss off, and he smacks you over the head and looks in your wallet. Finding it almost empty he just runs off with it. "; takecash($ir['money']); } } else if($chance == 2) { nothing(); } else { $gained = mt_rand(20,90); echo sprintf("You found a bag of cash on the side walk you open it up and find [b]\$%s[/b] was inside. ", number_format($gained)); givemoney($gained); } } function street_2() { global $ir, $db, $userid; $rand = mt_rand(1,2); if($rand == 1) { $hosptime = mt_rand(1,5); $reasonhosp = 'Stepped on a land mine while scavenging.'; $sql = sprintf("UPDATE users SET hospital = %u, hospreason = '%s', hp = (maxhp / 7) WHERE (userid = %u)", $hosptime, $reasonhosp, $userid); $db->query($sql); echo "You stepped on a land mine. "; echo "[b]Good news[/b]: You aren't dead "; echo "[b]Bad News[/b]: You have to stop exploring and go into Hospital "; } else { $gain = mt_rand(5,20); echo sprintf("While searching the streets you found [b]%s[/b] crystals.", $gain); givecrystals($gain); } } function street_3() { global $db, $ir, $userid; $fluff = mt_rand(1,3); if($fluff == 1) { $gain = mt_rand(50,100) * (floor($ir['level'] / 2) + 1); echo sprintf("While searching the streets you found [b]\$%s[/b]. ", number_format($gain)); givemoney($gain); } else if($fluff == 2) { nothing(); } else if($fluff == 3) { $jailtime = mt_rand(1,5); $reasonjail = 'Got Lured By The Police.'; $sql = sprintf("UPDATE users SET jail = %u, jail_reason = '%s' WHERE (userid = %u)", $jailtime, $userid); $db->query($sql); echo "You find a bag of crystals...It was a lure by the police! Looks like jail time for you. "; } } function street_4() { global $ir, $db, $userid; $random = mt_rand(1,2); if($random == 1) { $item = $db->fetch_single($db->query("SELECT itmid FROM items WHERE (itmbuyable = 1) ORDER BY RAND() LIMIT 1")); echo "You see a small item on the ground, and decide to pick it up... wonder what it is? (Hint, look in your inventory)"; item_add($userid, $item, 1); exp_gain(); } if($random == 2) { echo "You see something on the ground, and decide to pick it up. Looks deadly enough..."; $item = $db->fetch_single($db->query("SELECT itmid FROM items WHERE (itmbuyable = 1) ORDER BY RAND() LIMIT 1")); item_add($userid, $item, 1); exp_gain(); } } function street_5() { global $db, $ir, $userid; $erm = mt_rand(1,5); if($erm == 1) { $gain = ($ir['turns'] / 7); echo sprintf("You gain [b]%u[/b] steps!", $gain); $sql = sprintf("UPDATE users SET turns = turns + %u WHERE (userid = %u)", $gain, $userid); exp_gain(); } else if($erm == 2) { nothing(); } else if($erm == 3) { $expcur = (($ir['exp'] + $ir['exp_needed']) / 100); $exp = (($expcur) * mt_rand(1,5)); echo "You got in a scuffle with a bum, and WON you gained some EXP!! (Go have a look!) "; $sql = sprintf("UPDATE users SET exp = exp + %u WHERE (userid = %u)", $exp, $userid); $db->query($sql); exp_gain(); } else if ($erm == 4) { nothing(); } else if ($erm == 5) { nothing(); } } $ir['turns']--; echo sprintf(" You have [b]%u[/b] steps left ", $ir['turns']); if(!$ir['turns']) { echo "Sorry, all turns used! Go Back<a href='index.php'>Home</div>Go "; } else { echo "<form action='street.php?action=scavenge' method='post'>"; echo "<input type='hidden' name='action' />"; echo sprintf("<input type='text' name='steps' value='%u' /> ", $ir['turns']); echo "<input type='submit' value='Scavenge' />"; echo "</form>"; } function nothing() { $rand = mt_rand(1,4); if($rand == 1) { echo "Nothing here! "; } else if($rand == 2) { echo "You see a guy getting mugged, but you decide to keep walking. You don't want to be in his shoes anytime soon. "; } else if($rand == 3) { echo "Nothing to see here! "; } else { echo "While exploring the streets you found some cash, but a hobo came quickly behind you and whacked you over the head. You lurch in suprise and the hobo takes the cash and runs off."; } } function exp_gain() { global $exp_gained, $db, $userid; $sql = sprintf("UPDATE users SET street_exp = street_exp + %u WHERE (userid = %u)", $exp_gained, $userid); $db->query($sql); } function takecash($money) { global $db, $ir, $exp_gained, $userid; $takemoney = sprintf("UPDATE users SET money = money - %u, street_exp = street_exp + %u WHERE (userid = %u)", $money, $exp_gained, $userid); $db->query($takemoney); } function givecash($money) { global $db, $ir, $exp_gained, $userid; $givemoney = sprintf("UPDATE users SET money = money + %u, street_exp = street_exp + %u WHERE (userid = %u)", $money, $exp_gained, $userid); $db->query($givemoney); } function givecrystals($crystals) { global $db, $ir, $exp_gained, $userid; $givecrystals = sprintf("UPDATE users SET crystals = crystals + %u, street_exp = street_exp + %u WHERE (userid = %u)", $crystals, $exp_gained, $userid); $db->query($givecrystals); } function givemoney_crystals($money, $crystals) { global $db, $ir, $exp_gained, $userid; $finance = sprintf("UPDATE users SET money = money + %u, crystals = crystals + %u, street_exp = street_exp + %u WHERE (userid = %u)", $money, $crystals, $exp_gained, $userid); $db->query($finance); } $h->endpage; ?> And the MySql: ALTER TABLE 'users' ADD `street_level` int(11) NOT NULL DEFAULT 1; ALTER TABLE 'users' ADD `street_exp` int(11) NOT NULL DEFAULT 0; ALTER TABLE 'users' ADD 'street_needed` int(11) NOT NULL DEFAULT 100; ALTER TABLE 'users' ADD 'turns' int(11) NOT NULL DEFAULT 25; Quote
Karlos Posted April 16, 2009 Posted April 16, 2009 Re: I need help with a Mod i made ALTER TABLE `users` ADD `street_level` INT(3) UNSIGNED NOT NULL DEFAULT '1'; ALTER TABLE `users` ADD `street_exp` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `users` ADD `street_needed` INT(11) NOT NULL DEFAULT '100'; ALTER TABLE `users` ADD `turns` TINYINT(2) UNSIGNED NOT NULL DEFAULT '25'; That should be a bit better for the SQLÂ :wink: Note: Didn't look at code properly so I can't see what else I could edit xD Â Didn't check `street_exp` or `street_needed` Quote
Danny696 Posted April 17, 2009 Author Posted April 17, 2009 Re: I need help with a Mod i made heres an updated one that last one didnt give you money or steps didnt go down: streets.php <?php include(DIRNAME(__FILE__) . '/globals.php'); if($ir['jail']) { echo "<div align='center'>You see some bins outside your cell and you remember where they are so you can visit when you get out of [b]Jail[/b]</div>"; echo "<div align='center'>Go Back To <a href='jail.php'>Jail</div>"; $h->endpage(); exit; } if($ir['hospital']) { echo "<div align='center'>You see a bin next to you bed and start to look in it then the nurse comes in and sedates you</div>"; echo "<div align='center'>Go Back To <a href='hospital.php'>Hospital</div>"; $h->endpage(); exit; } if(!$ir['turns']) { echo "You do not have enough steps to scavenge the streets any more. Come back at newday. "; $h->endpage(); exit; } $expgained = (mt_rand(20,90) * $ir['street_level']); $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : ""; switch($_GET['action']) { case 'street1' : street_1(); break; case 'street2' : street_2(); break; case 'street3' : street_3(); break; case 'street4' : street_4(); break; case 'street5' : street_5(); break; default : street_index(); break; } function street_index() { global $ir, $userid; $min_perc = ($ir['street_exp'] / $ir['street_needed'] * 100); echo "<div style='text-align:center;'>You are currently scavenging the streets. You can find everything here from money and crystals, to items and experience "; echo sprintf("Your street level is %s and you have %s/%s (%s%%) mining experience", number_format($ir['street_level']), number_format($ir['street_exp']), number_format($ir['street_needed']), $min_perc); echo "</div>"; echo "<div align='center'> <u>Street Levels</u> [[url='streets.php?action=street1']Level 1 streets[/url]] [[url='streets.php?action=street2']Level 10 streets[/url]] [[url='streets.php?action=street3']Level 20 streets[/url]] [[url='streets.php?action=street4']Level 30 streets[/url]] [[url='streets.php?action=street5']Level 40 streets[/url]] "; } function street_1() { global $ir, $db, $userid; $chance = mt_rand(1,3); if($chance == 1) { $amnt = mt_rand(50,200); if($ir['money'] > $amnt) { echo sprintf("As you scavenge the streets you see a hobo; he asks you for \$%u and you tell him to piss off. Then he proceeds to smack the cr*p out of you. He takes the \$%s anyway. ", $amnt, $amnt); takecash($amnt); } else { echo "As you walk the streets you see a hobo he asks you for \$1. You tell him to piss off, and he smacks you over the head and looks in your wallet. Finding it almost empty he just runs off with it. "; takecash($ir['money']); } } else if($chance == 2) { nothing(); } else { $gained = mt_rand(20,90); echo sprintf("You found a bag of cash on the side walk you open it up and find [b]\$%s[/b] was inside. ", number_format($gained)); givecash($gained); } turndown(1); } function street_2() { global $ir, $db, $userid; if($ir['level'] < 10) { echo "You are not a high enough level"; $h->endpage(); exit; } $rand = mt_rand(1,2); if($rand == 1) { $hosptime = mt_rand(1,5); $reasonhosp = 'Stepped on a land mine while scavenging.'; $sql = sprintf("UPDATE users SET hospital = %u, hospreason = '%s', hp = (maxhp / 7) WHERE (userid = %u)", $hosptime, $reasonhosp, $userid); $db->query($sql); echo "You stepped on a land mine. "; echo "[b]Good news[/b]: You aren't dead "; echo "[b]Bad News[/b]: You have to stop exploring and go into Hospital "; } else { $gain = mt_rand(5,20); echo sprintf("While searching the streets you found [b]%s[/b] crystals.", $gain); givecrystals($gain); } turndown(1); } function street_3() { global $db, $ir, $userid; if($ir['level'] < 20) { echo "You are not a high enough level"; $h->endpage(); exit; } $fluff = mt_rand(1,3); if($fluff == 1) { $gain = mt_rand(50,100) * (floor($ir['level'] / 2) + 1); echo sprintf("While searching the streets you found [b]\$%s[/b]. ", number_format($gain)); givecash($gain); } else if($fluff == 2) { nothing(); } else if($fluff == 3) { $jailtime = mt_rand(1,5); $reasonjail = 'Got Lured By The Police.'; $sql = sprintf("UPDATE users SET jail = %u, jail_reason = '%s' WHERE (userid = %u)", $jailtime, $userid); $db->query($sql); echo "You find a bag of crystals...It was a lure by the police! Looks like jail time for you. "; } turndown(1); } function street_4() { global $ir, $db, $userid; if($ir['level'] < 30) { echo "You are not a high enough level"; $h->endpage(); exit; } $random = mt_rand(1,2); if($random == 1) { $item = $db->fetch_single($db->query("SELECT itmid FROM items WHERE (itmbuyable = 1) ORDER BY RAND() LIMIT 1")); echo "You see a small item on the ground, and decide to pick it up... wonder what it is? (Hint, look in your inventory)"; item_add($userid, $item, 1); exp_gain(); } if($random == 2) { echo "You see something on the ground, and decide to pick it up. Looks deadly enough..."; $item = $db->fetch_single($db->query("SELECT itmid FROM items WHERE (itmbuyable = 1) ORDER BY RAND() LIMIT 1")); item_add($userid, $item, 1); exp_gain(); } turndown(1); } function street_5() { global $db, $ir, $userid; if($ir['level'] < 40) { echo "You are not a high enough level"; $h->endpage(); exit; } $erm = mt_rand(1,5); if($erm == 1) { $gain = ($ir['turns'] / 7); echo sprintf("You gain [b]%u[/b] steps!", $gain); $sql = sprintf("UPDATE users SET turns = turns + %u WHERE (userid = %u)", $gain, $userid); exp_gain(); } else if($erm == 2) { nothing(); } else if($erm == 3) { $expcur = (($ir['exp'] + $ir['exp_needed']) / 100); $exp = (($expcur) * mt_rand(1,5)); echo "You got in a scuffle with a bum, and WON you gained some EXP!! (Go have a look!) "; $sql = sprintf("UPDATE users SET exp = exp + %u WHERE (userid = %u)", $exp, $userid); $db->query($sql); exp_gain(); } else if ($erm == 4) { nothing(); } else if ($erm == 5) { nothing(); } turndown(1); } $ir['turns']--; echo sprintf(" You have [b]%u[/b] steps left ", $ir['turns']); if(!$ir['turns']) { echo "Sorry, all turns used! Go Back [url='index.php']Home[/url] </div>"; } else { echo "<form action='street.php?action=scavenge' method='post'>"; echo "<input type='hidden' name='action' />"; echo sprintf("<input type='text' name='steps' value='%u' /> ", $ir['turns']); echo "<input type='submit' value='Scavenge' />"; echo "</form>"; } function nothing() { $rand = mt_rand(1,4); if($rand == 1) { echo "Nothing here! "; } else if($rand == 2) { echo "You see a guy getting mugged, but you decide to keep walking. You don't want to be in his shoes anytime soon. "; } else if($rand == 3) { echo "Nothing to see here! "; } else { echo "While exploring the streets you found some cash, but a hobo came quickly behind you and whacked you over the head. You lurch in suprise and the hobo takes the cash and runs off."; } } function exp_gain() { global $exp_gained, $db, $userid; $sql = sprintf("UPDATE users SET street_exp = street_exp + %u WHERE (userid = %u)", $exp_gained, $userid); $db->query($sql); } function takecash($money) { global $db, $ir, $exp_gained, $userid; $takemoney = sprintf("UPDATE users SET money = money - %u, street_exp = street_exp + %u WHERE (userid = %u)", $money, $exp_gained, $userid); $db->query($takemoney); } function givecash($money) { global $db, $ir, $exp_gained, $userid; $givecash = sprintf("UPDATE users SET money = money + %u, street_exp = street_exp + %u WHERE (userid = %u)", $money, $exp_gained, $userid); $db->query($givecash); } function givecrystals($crystals) { global $db, $ir, $exp_gained, $userid; $givecrystals = sprintf("UPDATE users SET crystals = crystals + %u, street_exp = street_exp + %u WHERE (userid = %u)", $crystals, $exp_gained, $userid); $db->query($givecrystals); } function givecash_crystals($money, $crystals) { global $db, $ir, $exp_gained, $userid; $finance = sprintf("UPDATE users SET money = money + %u, crystals = crystals + %u, street_exp = street_exp + %u WHERE (userid = %u)", $money, $crystals, $exp_gained, $userid); $db->query($finance); } function turndown($amnt) { global $db, $userid; $sql = sprintf("UPDATE users SET turns = turns - 1 WHERE (userid = %u)", $userid); $db->query($sql); } $h->endpage; ?> Sql Bits: ALTER TABLE `users` ADD `street_level` INT(3) UNSIGNED NOT NULL DEFAULT '1'; ALTER TABLE `users` ADD `street_exp` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `users` ADD `street_needed` INT(11) NOT NULL DEFAULT '100'; ALTER TABLE `users` ADD `turns` TINYINT(2) UNSIGNED NOT NULL DEFAULT '25'; Credits: Madgictallguy ~ Writing the code Karlos ~ Writing the Sql Quote
gideon prewett Posted April 20, 2009 Posted April 20, 2009 Re: I need help with a Mod i made You are currently scavenging the streets. You can find everything here from money and crystals, to items and experience Your street level is 1 and you have 0/100 (0%) mining experience dont u mean street exp ? Quote
gideon prewett Posted April 20, 2009 Posted April 20, 2009 Re: I need help with a Mod i made also if ur gunna claim somthing is urs atleast try to make it look like ur own work the searches are the standard mcc searches and well its ovious that its been merged with mine.php if ur working on a mod by useing bits of other peoples mods atleast be honest and give credit where its due Quote
Danny696 Posted April 20, 2009 Author Posted April 20, 2009 Re: I need help with a Mod i made Credits: Madgictallguy ~ Writing the code Karlos ~ Writing the Sql gideon prewett are you blind?!? and teh second one i think works Quote
gideon prewett Posted April 22, 2009 Posted April 22, 2009 Re: I need help with a Mod i made u misunderstood what i ment yes u had help from others to finish the code but what about nathanmarck whos mine.php u blatently used to add to the streets Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.