Danny696 Posted April 7, 2009 Posted April 7, 2009 i have a code i just made it took about 2~3 hours to fully make for a website they have uploaded it and it doesn't work the error is: Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/pirateba/public_html/streets2.php on line 35 and on line 35 is: if ($ir['jailtime'] => 1){ any help?? Quote
AlabamaHit Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made if ($ir['jailtime'] => 1){ to if ($ir['jailtime'] >= 1){ Quote
Danny696 Posted April 7, 2009 Author Posted April 7, 2009 Re: I need help with a Mod i made ty i fixed it now it wasnt 'jailtime' it was just 'jail' now i have another prob the error is Parse error: syntax error, unexpected T_STRING in /home/pirateba/public_html/streets2.php on line 65 line 65 is: $db->query("UPDATE users SET turns=turns-1 where userid=$userid",$c); Quote
jon182 Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made i might be wrong but i think you must move the second " to after $c and before ) Quote
Faz` Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made Nope, the " is in the right place. Quote
Danny696 Posted April 7, 2009 Author Posted April 7, 2009 Re: I need help with a Mod i made ok i will try that and tell u wat happens if it works i will post the mod on here Quote
AlabamaHit Posted April 7, 2009 Posted April 7, 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.""); Quote
Danny696 Posted April 7, 2009 Author Posted April 7, 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 Quote
Magictallguy Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made Show us line 64.. That's where the error will be.. Quote
AlabamaHit Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made MTG i gave him the fix on that... And you didn't code that lol...You might have spent 2 hours on it. But this is from a version 1. We can tell from the ,$c you had on there. lol. Quote
Magictallguy Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made MTG i gave him the fix on that... And you didn't code that lol...You might have spent 2 hours on it. But this is from a version 1. We can tell from the ,$c you had on there. lol. Some people seem to misunderstand the query() function. Although not required, you can safely use $c without any errors popping up. Go into the class files and have a look at the query() function. Also, the query he posted was fine. The problems lays on line 64. Chances are, he is missing a semi-colon ;. Quote
AlabamaHit Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made Naw not that look at his query not the one i done.. he has $db->query("UPDATE users SET turns=turns-1 where userid=$userid",$c); See it...he didn't bracket the $userid Quote
Magictallguy Posted April 7, 2009 Posted April 7, 2009 Re: I need help with a Mod i made Naw not that look at his query not the one i done.. he has $db->query("UPDATE users SET turns=turns-1 where userid=$userid",$c); See it...he didn't bracket the $userid You don't have to... Quote
Danny696 Posted April 7, 2009 Author Posted April 7, 2009 Re: I need help with a Mod i made line 64 is $chance = rand(1,4); Quote
Magictallguy Posted April 8, 2009 Posted April 8, 2009 Re: I need help with a Mod i made line 64 is $chance = rand(1,4); Right, not a clue then xD Both the query and that code is fine.. Quote
Cronus Posted April 8, 2009 Posted April 8, 2009 Re: I need help with a Mod i made line 64 is $chance = rand(1,4); Give the line before 64, that is where the error lies. Quote
Danny696 Posted April 8, 2009 Author Posted April 8, 2009 Re: I need help with a Mod i made i have editied it slitly hopefully iw ill work Quote
Jambomb Posted April 8, 2009 Posted April 8, 2009 Re: I need help with a Mod i made Isn't it best just to paste the hole code so we can check it more easyer ? Quote
Danny696 Posted April 9, 2009 Author Posted April 9, 2009 Re: I need help with a Mod i made ill post the code i just dont relii want people useing it untill i fully release it here it is <?php ///////////////////////////////////////////////////////// pleaese do not remove This Mode Coded By Hitman ///////////////////////////////////////////////////////// session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); get_street(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); switch($_GET['action']) { case 'street1': street_1(); break; case 'street1sub': street_1_sub(); break; case 'street2': street_2(); break; case 'street2sub': street_2_sub(); break; case 'street3': street_3(); break; case 'street3sub': street_3_sub(); break; case 'street4': street_4(); break; case 'street4sub': street_4_sub(); break; case 'street5': street_5(); break; case 'streete5sub': street_6_sub(); break; case 'street6': street_6(); break; case 'street6sub': street_6_sub(); break; default: street_index(); break; if ($ir['jail'] > 0){ print "<center>You See Some Bins Outside Your Cell You Rember Where They Are So You Can Visit When You Get Out Of [b]Jail[/b]</center>"; print "<center>Go Back To <a href='jail.php'>Jail</center>"; exit; } if ($ir['hospital'] > 0){ print "<center>You See A Bin Next To You Bed And Start To Look In It Then The Nurse Come's In And Sedates You</center>"; print "<center>Go Back To <a href='hospital.php'>Hospital</center>"; exit; { if ($ir['turns'] < 1) { print("You do not have enough steps to scavenge the streets any more. Come back at newday. "); }else { function street_index() { global $ir,$c,$userid; print "<center>You are currently scavenging the streets.You Can Find Everytihn Here Items, Money Or Experience Maby Even A Special Item Your street level is {$ir['street_level']} and you have {$ir['street_exp']}/{$ir['street_needed']} mining experience </center>"; print "<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]] [[url='streets.php?action=street6']Level 50 streets[/url]] print "<center> <u>This Mod Was Made By Hitman</u> } function streets_1() $chance = rand(1,4); $db->query("UPDATE users SET turns = turns - 1 WHERE userid = ".$userid.""); function streets_2() $chance = rand(1,6); $db->query("UPDATE users SET turns = turns - 1 WHERE userid = ".$userid.""); function streets_3() $chance = rand(1,9); $db->query("UPDATE users SET turns = turns - 1 WHERE userid = ".$userid.""); function streets_4() $chance = rand(1,12); $db->query("UPDATE users SET turns = turns - 1 WHERE userid = ".$userid.""); function streets_5() $chance = rand(1,15); $db->query("UPDATE users SET turns = turns - 1 WHERE userid = ".$userid.""); if ($chance == 1) { $amnt=rand(50,200); if($ir['money'] > $amnt) { print "As you scavenge the streets you see a hobo; he asks you for \$$amnt and you tell him to piss off. Then he proceeds to smack the shit out of you. He takes the \$$amnt anyway. "; $db->query("UPDATE users SET money=money- {$amnt } where userid=$userid",$c); $ir['money']-=$amnt; } else { print "As you walk the streets you see a hobo he asks you for \$1 you tell him to piss off he smacks you over the head and looks in your wallet. Finding it almost empty he just runs off with it. "; $db->query("UPDATE users SET money=0 where userid=$userid",$c); $ir['money']=0; } } if ($chance == 2) { print "Nothing here. "; } if ($chance == 3) { $expgained=rand(20,90)*$ir['street_level']; $gained=rand(20,90)*$ir['level']; print "You found a bag of cash on the side walk you open it up and find [b] \$$gained[/b] was inside. "; $db->query("UPDATE users SET money=money+$gained where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 4) { $hosptime=(int) rand(1,5); $loseruser = $ir['userid']; $reasonhosp = 'Stepped on a land mine while scavenging.'; $db->query("UPDATE users SET hospital=$hosptime WHERE userid=$loseruser",$c); $db->query("UPDATE users SET hospreason='$reasonhosp' WHERE userid=$loseruser",$c); event_add($ir['userid'],"You stepped on a land mine while exploring. Do be a bit more careful next time...",$c); die ("You stepped on a land mine. [b]Good news[/b]: You aren't dead [b]Bad News[/b]:You have to stop exploring and go into Hospital "); } if ($chance == 5) { $expgained=rand(20,90)*$ir['street_level']; $gain = rand(5,20); print "While searching the streets you found [b]$gain[/b] crystals."; $db->query("UPDATE users SET crystals=crystals+$gain where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 6) { $expgained=rand(20,90)*$ir['street_level']; $gain = rand(50,100)*(floor($ir['level']/2)+1); print "While searching the streets you found [b] \$$gain[/b]. "; $db->query("update users set money=money+$gain where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 7) { print "You see a guy getting mugged, but you decide to keep walking. You don't want to be in his shoes anytime soon. "; } if ($chance == 8) { $jailtime=(int) rand(1,5); $loseruser = $ir['userid']; $reasonjail = 'Got Lured By The Police.'; $db->query("UPDATE users SET jail=$jailtime WHERE userid=$loseruser",$c); $db->query("UPDATE users SET jailreason='$reasonjail' WHERE userid=$loseruser",$c); event_add($ir['userid'],"You Got Lured By The Police. [b]Loser[/b]",$c); die ("You Find A Bag Of Crystals...It Was A Lure By The Police Looks Like Jail Time For You. "); } if ($chance == 9) { $expgained=rand(20,90)*$ir['street_level']; print "You see a small item on the ground, and decide to pick it up... wonder what it is? (Hint, look in your inventory lol)"; $itemidexplore = 40; $db->query("INSERT INTO inventory VALUES('',$itemidexplore,$userid,1)",$c); print" "; $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 10) { $expgained=rand(20,90)*$ir['street_level']; print "You see a syringe on the ground, and decide to pick it up. Looks deadly enough..."; $itemidexplore = 16; $db->query("INSERT INTO inventory VALUES('',$itemidexplore,$userid,1)",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 11) { $expgained=rand(20,90)*$ir['street_level']; $gain = $ir['turns']/7 print "You Gain [b] \$$gain[/b] Steps. "; $db->query("update users set steps=steps+$gain where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 12) { print "Nothing here. "; } if ($chance == 13) { $expgained=rand(20,90)*$ir['street_level']; $expcur=(($ir['exp']+$ir['exp_needed'])/100); $exp=(($expcur)*rand(1,5)); print "You got in a scuffle with a bum, and WON you gained some EXP!! (Go have a look!) "; $db->query("UPDATE users SET exp=exp+$exp WHERE userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 14) { print "Nothing here. "; } if ($chance == 15) { print "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."; } $ir['turns']--; print"you have [b] {$ir['turns'] }[/b] steps left "; } } if($ir['turns']==0) { print "Sorry, all turns used! "; } else { print " <form method=post action=street.php?action=scavenge><input type=hidden name=action value=scavenge><input type='text' name='steps' value=' {$ir['turns'] }'> <input type=submit value='scavenge'></form>"; } } $h->endpage; ?> } Quote
Danny696 Posted April 9, 2009 Author Posted April 9, 2009 Re: I need help with a Mod i made and the MySql bits: 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 ; Quote
seanybob Posted April 9, 2009 Posted April 9, 2009 Re: I need help with a Mod i made First off, you have a floating } at the end of your file. I imagine it's missing from the switch case... switch($_GET['action']) { case 'street1': street_1(); break; case 'street1sub': street_1_sub(); break; case 'street2': street_2(); break; case 'street2sub': street_2_sub(); break; case 'street3': street_3(); break; case 'street3sub': street_3_sub(); break; case 'street4': street_4(); break; case 'street4sub': street_4_sub(); break; case 'street5': street_5(); break; case 'streete5sub': street_6_sub(); break; case 'street6': street_6(); break; case 'street6sub': street_6_sub(); break; default: street_index(); break; Where's the end bracket for this? o.0 Quote
Danny696 Posted April 9, 2009 Author Posted April 9, 2009 Re: I need help with a Mod i made woops i posted the wrong code heres the proper 1 <?php session_start(); require "globals.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); get_mine(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); switch($_GET['action']) { case 'street1': street_1(); break; case 'mine1sub': street_1_sub(); break; case 'street2': street_2(); break; case 'street2sub': street_2_sub(); break; case 'street3': street_3(); break; case 'street3sub': street_3_sub(); break; case 'street4': street_4(); break; case 'street4sub': street_4_sub(); break; case 'street5': street_5(); break; case 'streete5sub': street_6_sub(); break; case 'mine6': mine_6(); break; case 'street6sub': street_6_sub(); break; default: street_index(); break; } function street_index() { global $ir,$c,$userid; print "<center>You are currently scavenging the streets.You Can Find Everytihn Here Items, Money Or Experience Maby Even A Special Item Your street level is {$ir['street_level']} and you have {$ir['street_exp']}/{$ir['street_needed']} mining experience </center>"; print "<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]] [[url='streets.php?action=street6']Level 50 streets[/url]] } if ($ir['jailtime'] > 0){ print "<center>You See Some Bins Outside Your Cell You Rember Where They Are So You Can Visit When You Get Out Of [b]Jail[/b]</center>"; print "<center>Go Back To <a href='jail.php'>Jail</center>"; exit; } if ($ir['hospital'] > 0){ print "<center>You See A Bin Next To You Bed And Start To Look In It Then The Nurse Come's In And Sedates You</center>"; print "<center>Go Back To <a href='hospital.php'>Hospital</center>"; exit; { if ($ir['turns'] < 1) { print("You do not have enough steps to scavenge the streets any more. Come back at newday. "); } function streets_1() }else { $chance = rand(1,4); $db->query("UPDATE users SET turns=turns-1 where userid={$userid}"); function streets_2() }else { $chance = rand(1,6); $db->query("UPDATE users SET turns=turns-1 where userid={$userid}"); function streets_3() }else { $chance = rand(1,9); $db->query("UPDATE users SET turns=turns-1 where userid={$userid}"); function streets_4() }else { $chance = rand(1,12); $db->query("UPDATE users SET turns=turns-1 where userid={$userid}"); function streets_5() }else { $chance = rand(1,15); $db->query("UPDATE users SET turns=turns-1 where userid={$userid}"); if ($chance == 1) { $amnt=rand(50,200); if($ir['money'] > $amnt) { print "As you scavenge the streets you see a hobo; he asks you for \$$amnt and you tell him to piss off. Then he proceeds to smack the shit out of you. He takes the \$$amnt anyway. "; $db->query("UPDATE users SET money=money- {$amnt } where userid=$userid",$c); $ir['money']-=$amnt; } else { print "As you walk the streets you see a hobo he asks you for \$1 you tell him to piss off he smacks you over the head and looks in your wallet. Finding it almost empty he just runs off with it. "; $db->query("UPDATE users SET money=0 where userid=$userid",$c); $ir['money']=0; } } if ($chance == 2) { print "Nothing here. "; } if ($chance == 3) { $expgained=rand(20,90)*$ir['street_level']; $gained=rand(20,90)*$ir['level']; print "You found a bag of cash on the side walk you open it up and find [b] \$$gained[/b] was inside. "; $db->query("UPDATE users SET money=money+$gained where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 4) { $hosptime=(int) rand(1,5); $loseruser = $ir['userid']; $reasonhosp = 'Stepped on a land mine while scavenging.'; $db->query("UPDATE users SET hospital=$hosptime WHERE userid=$loseruser",$c); $db->query("UPDATE users SET hospreason='$reasonhosp' WHERE userid=$loseruser",$c); event_add($ir['userid'],"You stepped on a land mine while exploring. Do be a bit more careful next time...",$c); die ("You stepped on a land mine. [b]Good news[/b]: You aren't dead [b]Bad News[/b]:You have to stop exploring and go into Hospital "); } if ($chance == 5) { $expgained=rand(20,90)*$ir['street_level']; $gain = rand(5,20); print "While searching the streets you found [b]$gain[/b] crystals."; $db->query("UPDATE users SET crystals=crystals+$gain where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 6) { $expgained=rand(20,90)*$ir['street_level']; $gain = rand(50,100)*(floor($ir['level']/2)+1); print "While searching the streets you found [b] \$$gain[/b]. "; $db->query("update users set money=money+$gain where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 7) { print "You see a guy getting mugged, but you decide to keep walking. You don't want to be in his shoes anytime soon. "; } if ($chance == 8) { $jailtime=(int) rand(1,5); $loseruser = $ir['userid']; $reasonjail = 'Got Lured By The Police.'; $db->query("UPDATE users SET jail=$jailtime WHERE userid=$loseruser",$c); $db->query("UPDATE users SET jailreason='$reasonjail' WHERE userid=$loseruser",$c); event_add($ir['userid'],"You Got Lured By The Police. [b]Loser[/b]",$c); die ("You Find A Bag Of Crystals...It Was A Lure By The Police Looks Like Jail Time For You. "); } if ($chance == 9) { $expgained=rand(20,90)*$ir['street_level']; print "You see a small item on the ground, and decide to pick it up... wonder what it is? (Hint, look in your inventory lol)"; $itemidexplore = 40; $db->query("INSERT INTO inventory VALUES('',$itemidexplore,$userid,1)",$c); print" "; $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 10) { $expgained=rand(20,90)*$ir['street_level']; print "You see a syringe on the ground, and decide to pick it up. Looks deadly enough..."; $itemidexplore = 16; $db->query("INSERT INTO inventory VALUES('',$itemidexplore,$userid,1)",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 11) { $expgained=rand(20,90)*$ir['street_level']; $gain = $ir['turns']/7 print "You Gain [b] \$$gain[/b] Steps. "; $db->query("update users set steps=steps+$gain where userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 12) { print "Nothing here. "; } if ($chance == 13) { $expgained=rand(20,90)*$ir['street_level']; $expcur=(($ir['exp']+$ir['exp_needed'])/100); $exp=(($expcur)*rand(1,5)); print "You got in a scuffle with a bum, and WON you gained some EXP!! (Go have a look!) "; $db->query("UPDATE users SET exp=exp+$exp WHERE userid=$userid",$c); $db->query("UPDATE users SET street_exp=street_exp+$expgained where userid=$userid",$c); } if ($chance == 14) { print "Nothing here. "; } if ($chance == 15) { print "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."; } $ir['turns']--; print"you have [b] {$ir['turns'] }[/b] steps left "; } } if($ir['turns']==0) { print "Sorry, all turns used! Go Back<a href='index.php'>Home</center>Go "; } else { print " <form method=post action=street.php?action=scavenge><input type=hidden name=action value=scavenge><input type='text' name='steps' value=' {$ir['turns'] }'> <input type=submit value='scavenge'></form>"; } } $h->endpage; ?> } Quote
DELETE ME NOW! Posted April 9, 2009 Posted April 9, 2009 Re: I need help with a Mod i made print "<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]] [[url='streets.php?action=street6']Level 50 streets[/url]] You didnt end the print.... end it with "; Quote
Danny696 Posted April 9, 2009 Author Posted April 9, 2009 Re: I need help with a Mod i made ok do u see anything else wrong? *bumped* Quote
AlabamaHit Posted April 9, 2009 Posted April 9, 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 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.