bmw11 Posted June 4, 2011 Posted June 4, 2011 (edited) syntax error on lines "27" "62" and "65" <?php //mod coded by sniko` //FREE MODIFICATION //2008 //free MOD include "globals.php"; print "<h2>Harry's Ammo Shop</h2> <i>Here you can buy Ammo, Ammo is needed to attack people with guns.</i> You Currently Have {$ir['ammo']} Bullets. <table width=100% border=1> <th height=10%>Ammo Ammount</th><th height=10%>Price</th><th height=10%>Buy</th> <tr> <td> 6 </td> <td> $10 </td> <td> <a href="http://ammoshop.php?spend=6" target="_blank">Buy 6 Bullets</a> </td> <tr> <td> Out Of Stock </td> <td> Not Available </td> <td> Not Available </td> <tr> <td> Out Of Stock </td> <td> Not Available </td> <td> Not Available </td> </table>"; if($_GET['spend'] == '6') { if($ir['money'] <10) { print "You don't have enough money to buy 6 Bullets, you need $10!"; } else { if($ir['money'] >10) { print "Congratulations, you bought 6 Bullets for $10! <a href="http://index.php" target="_blank">Go Home</a> <a href="http://inventory.php" target="_blank">Inventory</a> "; $db->query("UPDATE users SET money=money-10,ammo=6 WHERE userid=$userid",$c); } } } $h->endpage(); ?> Edited June 4, 2011 by Dominion added code tags... yet again Quote
bluegman991 Posted June 4, 2011 Posted June 4, 2011 (edited) <?php //mod coded by sniko` //FREE MODIFICATION //2008 //free MOD include "globals.php"; print "<h2>Harry's Ammo Shop</h2> <i>Here you can buy Ammo, Ammo is needed to attack people with guns.</i> You Currently Have {$ir['ammo']} Bullets. <table width=100% border=1> <th height=10%>Ammo Ammount</th><th height=10%>Price</th><th height=10%>Buy</th> <tr> <td> 6 </td> <td> \$10 </td> <td> <a href=\"http://ammoshop.php?spend=6\" target=\"_blank\">Buy 6 Bullets</a> </td> <tr> <td> Out Of Stock </td> <td> Not Available </td> <td> Not Available </td> <tr> <td> Out Of Stock </td> <td> Not Available </td> <td> Not Available </td> </table>"; if($_GET['spend'] == '6') { if($ir['money'] <10) { print "You don't have enough money to buy 6 Bullets, you need $10!"; } else { if($ir['money'] >10) { print "Congratulations, you bought 6 Bullets for $10! <a href=\"http://index.php\" target=\"_blank\">Go Home</a> <a href=\"http://inventory.php\" target=\"_blank\">Inventory</a> "; $db->query("UPDATE users SET money=money-10,ammo=6 WHERE userid=$userid",$c); } } } $h->endpage(); ?> ^^should work.. a few tips when you echo or print a string if you echo with double quotes (one of these ") you need to add a backslash (\) before a dollar sign ($) if you want the actual sign to show otherwise php will think its a variable next when you refer to a string using double quotes. any double quotes inside of that string will need a backslash in front of them if you refer to a string using single quotes any single quotes inside that string will need a backslash in front of them Edited June 4, 2011 by bluegman991 Quote
Dominion Posted June 4, 2011 Posted June 4, 2011 (edited) 2nd time today i have said this to you(http://makewebgames.io/showthread.php/39511-please-help-Parse-error-syntax-error?p=255961&viewfull=1#post255961)... Use code tags when posting. [ php] code here [/ php] take out the space. Edit - In fact it's the same error as last time. Look how you were told to fix it. Edited June 4, 2011 by Dominion Quote
Danny696 Posted June 4, 2011 Posted June 4, 2011 (edited) How are we supposed to know what lines what? wow, can you not read, first line of the post says this; syntax error on lines "27" "62" and "65" Try removing the http:// from the links. Its simple stuff, try learning to code before setting up a game, or your going to sped alot of money. Edited June 4, 2011 by Danny696 Quote
Kieran-R Posted June 4, 2011 Posted June 4, 2011 wow, can you not read, first line of the post says this; Try removing the http:// from the links. Its simple stuff, try learning to code before setting up a game, or your going to sped alot of money. Actually, I meant to mean that how are we supposed to know what line line 27 ect is? No code tags = no line numbers.... Quote
bluegman991 Posted June 4, 2011 Posted June 4, 2011 (edited) lol i just noticed those links http://index.php <-- thats a funny link whatever php code reader mwg is using needs to be replaced and wrong things are being quoted to Originally Posted by bluegman911 syntax error on lines "27" "62" and "65" :confused: dont remember saying that and hold on why does it say my name is bluegman911 when my name is bluegman991 :lol: Edited June 4, 2011 by bluegman991 Quote
bmw11 Posted June 4, 2011 Author Posted June 4, 2011 there is anouther problem , in attack.php it says : Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/husain/public_html/attack.php on line 23 attack : <?php $menuhide=1; $atkpage=1; include "globals.php"; $_GET['ID'] == (int) $_GET['ID']; if(!$_GET['ID']) { print "WTF you doing, bro?"; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { print "Only the crazy attack themselves."; $h->endpage(); exit; } else if ($ir['hp'] <= 1) { print "Only the crazy attack when their unconscious.<br /> } else if ($r['ammo'] > = 1) { print "You Have NO Bullets Go Buy Some From The Ammo Shop <a href="http://index.php" target="_blank">Back</a>"; $h->endpage(); exit; } <a href='index.php'>Back</a>"; $h->endpage(); exit; } else if ($_SESSION['attacklost'] == 1) { print "Only the losers of all their EXP attack when they've already lost.<br /> <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } //get player data $youdata=$ir; $q=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); $odata=$db->fetch_row($q); $myabbr=($ir['gender']=="Male") ? "his" : "her"; $oabbr=($ir['gender']=="Male") ? "his" : "her"; if($ir['attacking'] && $ir['attacking'] != $_GET['ID']) { print "Bad, bad, bad girl.<br /> <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } if($odata['hp'] == 1) { print "This player is unconscious.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['hospital']) { print "This player is in hospital.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['hospital']) { print "While in hospital you can't attack.<br /> <a href='hospital.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['jail']) { print "This player is in jail.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['jail']) { print "While in jail you can't attack.<br /> <a href='jail.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['travelling']) { print "That player is travelling.<br /> <a href='index.php'>> Back</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } print "<table width=100%><tr><td colspan=2 align=center>"; if($_GET['wepid']) { if($_SESSION['attacking']==0 && $ir['attacking'] == 0) { if ($youdata['energy'] >= $youdata['maxenergy']/2) { $youdata['energy']-= floor($youdata['maxenergy']/2); $me=floor($youdata['maxenergy']/2); $db->query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid"); $_SESSION['attacklog']=""; $_SESSION['attackdmg']=0; } else { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } } $_SESSION['attacking']=1; $ir['attacking']=$odata['userid']; $db->query("UPDATE users SET attacking={$ir['attacking']} WHERE userid=$userid"); $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; //damage if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary']) { print "Stop trying to abuse a game bug. You can lose all your EXP for that.<br /> <a href='index.php'>> Home</a>"; $db->query("UPDATE users SET exp=0 where userid=$userid",$c); die(""); } $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid={$_GET['wepid']}"); $r1=$db->fetch_row($qo); $mydamage=(int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000)); $hitratio=max(10,min(60*$ir['agility']/$odata['agility'],95)); if(rand(1,100) <= $hitratio ) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$odata['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } if($mydamage < -100000) { $mydamage=abs($mydamage); } else if($mydamage < 1) { $mydamage=1; } $crit=rand(1,40); if($crit==17) { $mydamage*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $mydamage/=(rand(20,40)/10); } $mydamage=round($mydamage); $odata['hp']-=$mydamage; if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } $db->query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}"); print "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; $_SESSION['attackdmg']+=$mydamage; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. Using {$myabbr} {$r1['itmname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n"; } else { print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n"; } if($odata['hp'] <= 0) { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; $db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}"); print "<br /> <b>What do you want to do with {$odata['username']} now?</b><br /> <form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them' /></form> <form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' /></form> <form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them' /></form>"; } else { //choose opp gun $eq=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$odata['equip_primary']}, {$odata['equip_secondary']})"); if(mysql_num_rows($eq) == 0) { $wep="Fists"; $dam=(int)((((int) ($odata['strength']/$ir['guard']/100)) +1)*(rand(8000,12000)/10000)); } else { $cnt=0; while($r=$db->fetch_row($eq)) { $enweps[]=$r; $cnt++; } $weptouse=rand(0,$cnt-1); $wep=$enweps[$weptouse]['itmname']; $dam=(int) (($enweps[$weptouse]['weapon']*$odata['strength']/($youdata['guard']/1.5))*(rand(8000,12000)/10000)); } $hitratio=max(10,min(60*$odata['agility']/$ir['agility'],95)); if(rand(1,100) <= $hitratio) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$ir['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $dam-=$db->fetch_single($q3); } if($dam < -100000) { $dam=abs($dam); } else if($dam < 1) { $dam=1; } $crit=rand(1,40); if($crit==17) { $dam*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $dam/=(rand(20,40)/10); } $dam=round($dam); $youdata['hp']-=$dam; if ($youdata['hp']==1) { $dam+=1; $youdata['hp']=0; } $db->query("UPDATE users SET hp=hp-$dam WHERE userid=$userid"); $ns=$_GET['nextstep']+1; print "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font><br />\n"; } else { $ns=$_GET['nextstep']+1; print "<font color=red>{$ns}. {$odata['username']} tried to hit you but missed ({$youdata['hp']})</font><br />\n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font><br />\n"; } if($youdata['hp'] <= 0) { $youdata['hp']=0; $_SESSION['attacklost']=1; $db->query("UPDATE users SET hp=0 WHERE userid=$userid"); print "<form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />"; } } } else if ($odata['hp'] < 5) { print "You can only attack those who have health"; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { print "You are in the same gang as {$odata['username']}! What are you smoking today dude!"; $h->endpage(); exit; } else if ($youdata['energy'] < $youdata['maxenergy']/2) { print "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } else if ($youdata['location'] != $odata['location']) { print "You can only attack someone in the same location!"; $h->endpage(); exit; } else { } print "</td></tr>"; if($youdata['hp'] <= 0 || $odata['hp'] <= 0) { print "</table>"; } else { $vars['hpperc']=round($youdata['hp']/$youdata['maxhp']*100); $vars['hpopp']=100-$vars['hpperc']; $vars2['hpperc']=round($odata['hp']/$odata['maxhp']*100); $vars2['hpopp']=100-$vars2['hpperc']; $mw=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']})"); print "<tr><td colspan=2 align='center'>Attack with:<br />"; if($db->num_rows($mw) > 0) { while($r=$db->fetch_row($mw)) { if(!$_GET['nextstep']) { $ns=1; } else { $ns=$_GET['nextstep']+2; } if($r['itmid']==$ir['equip_primary']) { print "<b>Primary Weapon:</b> "; } if($r['itmid']==$ir['equip_secondary']) { print "<b>Secondary Weapon:</b> "; } print "<a href='attack.php?nextstep=$ns&ID={$_GET['ID']}&wepid={$r['itmid']}'>{$r['itmname']}</a><br />"; } } else { print "You have nothing to fight with."; } print "</table>"; print "<table width='50%' align='center'><tr><td align=right>Your Health: </td><td><img src=greenbar.png width={$vars['hpperc']} height=10><img src=redbar.png width={$vars['hpopp']} height=10></td><tr><td align=right>Opponents Health: </td><td><img src=greenbar.png width={$vars2['hpperc']} height=10><img src=redbar.png width={$vars2['hpopp']} height=10></td></tr></table>"; } $h->endpage(); ?> Quote
bluegman991 Posted June 4, 2011 Posted June 4, 2011 (edited) ok bmw im gonna help you spot this error yourself (if no one posts it or has already posted it) in the error sentence it says "unexpected" tencapsed and whitespace "expecting" tstring or tvariable now expecting tstring what that usually means is you forgot to add your endquotes somewhere on the said line or a line before and the other one (unexpected tencapsed and whitespace) means that you forgot to add a semicolon at the end of that line or a line before do you see somewhere on that line or a line before thats missing something? (hint:Look 2 lines up) Edited June 4, 2011 by bluegman991 1 Quote
Dominion Posted June 4, 2011 Posted June 4, 2011 I suggest you login to your mccodes.com account and download the updated patch. Quote
bmw11 Posted June 4, 2011 Author Posted June 4, 2011 ok so i think i have to add a quote at the end of line 22 Quote
bmw11 Posted June 4, 2011 Author Posted June 4, 2011 ok thats fixd but now it says print Parse error: syntax error, unexpected '>' in /home/husain/public_html/attack.php on line 21 Quote
lucky3809 Posted June 4, 2011 Posted June 4, 2011 well his scripts are fine he just needs to learn echo and print.... if your using double quotes after print or echo you need to use single quotes inside that statement... I have already explained this to him... such as if your using... print " <a href=" ">Hello world</a>"; <---this is the wrong way in which is in all your scripts... you need to either have print ' <a href=" ">Hello world</a>'; or print " <a href=' '>Hello world</a>"; the end of your print or echo statements is "; or '; that is how you can tell if you are still inside a print/echo statement you should know the beginning is print" or print' anything inside of that needs the proper quotes....and slashes Quote
lucky3809 Posted June 4, 2011 Posted June 4, 2011 ok so i think i have to add a quote at the end of line 22 nope wrong lol... this is your error print "Only the crazy attack when their unconscious. see whats missing? the end of the statement "; if the line indicates a perfect line with no errors the error is above that line or on the next one down. Quote
lucky3809 Posted June 4, 2011 Posted June 4, 2011 this is line 19-26 else if ($ir['hp'] <= 1) { print "Only the crazy attack when their unconscious.-----------------line 21 } else if ($r['ammo'] > = 1)---------------------line23 { print "You Have NO Bullets Go Buy Some From The Ammo Shop <a href="http://index.php" target="_blank">Back</a>"; $h->endpage(); exit; } see where i found that error? You will get another error after you fix it, which will then be line 25... i explained your problem above this post... Quote
bmw11 Posted June 4, 2011 Author Posted June 4, 2011 il try it and see yep i know i see line 25 error lol Quote
lucky3809 Posted June 4, 2011 Posted June 4, 2011 I will fix the script for you then i want you to match it up to your one that dont work and learn what your errors are... Quote
bmw11 Posted June 4, 2011 Author Posted June 4, 2011 print "Only the crazy attack when their unconscious."<br /> } else if ($r['ammo'] > = 1) Quote
bmw11 Posted June 4, 2011 Author Posted June 4, 2011 ok thank you for helping me out lucky and blueman Quote
lucky3809 Posted June 4, 2011 Posted June 4, 2011 Replace your top half with <?php $menuhide=1; $atkpage=1; include "globals.php"; $_GET['ID'] == (int) $_GET['ID']; if(!$_GET['ID']) { print "WTF you doing, bro?"; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { print "Only the crazy attack themselves."; $h->endpage(); exit; } else if ($ir['hp'] <= 1){ print "Only the crazy attack when their unconscious."; } else if ($r['ammo'] >= 1){ print "You Have NO Bullets Go Buy Some From The Ammo Shop <a href='http://index.php' target='_blank'>Back</a>'; $h->endpage(); exit; } print " <a href='index.php'>Back</a>"; $h->endpage(); exit; } else if ($_SESSION['attacklost'] == 1) { print "Only the losers of all their EXP attack when they've already lost. <a href='index.php'>Back</a>"; $_SESSION['attacklost']=0; $h->endpage(); exit; } Quote
bmw11 Posted June 4, 2011 Author Posted June 4, 2011 done : Parse error: syntax error, unexpected T_STRING in /home/husain/public_html/attack.php on line 30 Quote
lucky3809 Posted June 4, 2011 Posted June 4, 2011 as for using can't in a single quote either change it to can not or add the slash to it..and they've add the slash to that.. 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.