DELETE-ME-NOW- Posted August 12, 2010 Share Posted August 12, 2010 I got a attack script here, but its got an error in it that i cannot reapair :( Tried quite a few different things Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home2/mafiakil/public_html/attack.php on line 124 <?php $atkpage=1; $menuhide=1; @include_once(DIRNAME(__FILE__) .'/globals.php'); $_GET['ID'] = (isset($_GET['ID']) && !empty($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(@intval($_GET['ID'])) : id_error(); //i used a function for simplicity function id_error() { global $h; echo'You havent selected who to attack.'; exit($h->endpage()); } //Start some checks if($_GET['ID'] == $userid) { echo'Why attack yourself?'; exit($h->endpage()); } if($ir['maxhp'] < 10) { echo'You cant attack with no health.'; exit($h->endpage()); } $enperc = abs(@intval($ir['energy']/$ir['maxenergy']*100)); if($enperc < 25) { echo'You need atleast 25% of your energy to attack.'; exit($h->endpage()); } if($ir['jail']) { echo'You cannot attack someone while in jail.'; exit($h->endpage()); } if($ir['hospital']) { echo'You cannot attack someone while in the hospital.'; exit($h->endpage()); } $them = $db->fetch_row($db->query("SELECT u.*,us.* ". "FROM `users` AS u ". "LEFT JOIN `userstats` AS us ON (u.`userid` = us.`userid`) ". "WHERE (u.`userid` = ". $_GET['ID'] .");")); if(!$them['userid']) { echo'This user isnt real.'; exit($h->endpage()); } if($them['jail']) { echo'You cant attack someone whose in jail.'; exit($h->endpage()); } if($them['hospital']) { echo'You cant attack someone whose in the hospital.'; exit($h->endpage()); } if($ir['location'] != $them['location']) { echo'You can\'t attack someone whose in another location.'; exit($h->endpage()); } //Take away the energy if($ir['energy'] >= $ir['maxenergy']/4) { $ir['energy']-=floor($ir['maxenergy']/4); $myenergy = floor($ir['maxenergy']/4); $db->query("UPDATE `users` SET `energy` = `energy` - ". $myenergy ." WHERE (`userid` = ". $userid .");"); $_SESSION['attacklog']=''; $_SESSION['attackdmg']=0; } //Get weapons $pri = $db->query("SELECT * FROM `items` WHERE (`itmid` = ". $ir['equip_primary'] .");"); // $user_class1 & $q0 $sec = $db->query("SELECT * FROM `items` WHERE (`itmid` = ". $ir['equip_armor'] .");"); // $user_class2 & $q1 $sec = $db->fetch_row($sec); if(!$db->num_rows($pri)) { $pri = array(); $weapon = "Fists"; $pri['weapon'] = 10; } else { $pri = $db->fetch_row($pri); $weapon = $pri['itmname']; } $tpri = $db->query("SELECT * FROM `items` WHERE (`itmid` IN(". $them['equip_primary'] ."));"); if(!$db->num_rows($tpri)) { $wep = 'Fists'; } else { $cnt = 0; while($r = $db->fetch_row($tpri)) { $enweps[] = $r; $cnt++; } $weptouse = rand(0, $cnt-1); $wep = $enweps[$weptouse]['itmname']; } //HP stuff $my = $ir['hp']; $u = $them['hp']; $stre = number_format($ir['strength']); $weps = $pri['weapon']; $dam = $stre*($weps*100); echo'<center><big>Fighting '.$them['username'].'</big></center> You are in a fight with '.$them['username'].' You come in with your '.$weapon.'. With a strength of '.$dam.' (+'.$weps.'%) '; //Start the attacks $shalli = ($ir['agility'] > $them['agility']) ? 1 : 0; $pri2 = $db->fetch_row($db->query("SELECT * FROM `items` WHERE (`itmid` IN (". $them['equip_primary'] ."));")); while($my > 0 && $u > 0) { $damage = (($pri['weapon']*$ir['strength']/($them['guard']/1.5))*(rand(8000,12000)/10000)); $theirdamage = (($enweps[$weptouse]['weapon']*$them['strength']/($ir['guard']/1.5))*(rand(8000,12000)/10000)); $damage = ($damage < 1) ? 1 : $damage; $theirdamage = ($theirdamage < 1) ? 1 : $theirdamage; if($wait == 0) { $my = $my-$theirdamage; echo'<span style="color: red;">'.$them['username'].' Takes their turn to swing at you!</span> '; echo $them['username'].' hit you using thier '.$wep.'. It did '. number_format($theirdamage) .' damage. '; } else { $wait = 0; } if($my > 0) { $u = $u-$damage; echo '<span style="color: green;">You take a swing at them!</span> You hit '.$them['username'] .' using your '.$weapon.'. It did '. number_format($damage) .' damage. '; } } if($u <= 0) { $loser = $them['userid']; $u = 0; $_SESSION['attackwon'] = $loser; $db->query("UPDATE `users` SET `hp`=0 WHERE (`userid` = ". $loser .");"); echo'<hr /> <span style="font-weight: bold;">What shall you do with '. $them['username'] .' now?</span> <form action="attackwon.php?ID=['userid']'. $loser .' method="post"><input type="submit" value="Mug them"> <form action="attackbeat.php?ID=['userid']'. $loser .' method="post"><input type="submit" value="Hospitalize them"> <form action="attacktake.php?ID=['userid']'. $loser .' method="post"><input type="submit" value="Leave them"> '; } if($my <= 0) { $winner = $them['userid']; $my = 0; $_SESSION['attacklost'] = 1; $db->query("UPDATE `users` SET `hp`=0 WHERE (`userid` = ". $userid .");"); echo'<hr /><span style="font-weight: bold;">You lost the fight. In 3 seconds, you will be re-directed. Hold on! <meta http-equiv="refresh" content="3;url=attacklost.php?ID='. $winner .'" />'; } echo $ennd.$gangs.$bot; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 LIne 124 is wrong...now look at it and see the error! Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 But seriously. I have looked at it over and over, and fixed the ovious. It still doesnt work!!! :( Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 You havnt looked hard enough then. Cmon your gonna kick yourself when you realise! Line 124 Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 Seriously. Im out of idea lol. seriously. Ive tried the obvious and they aint working :( Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 Look at line 118 now what is that doing there. Now look at line 124 , 125 and 126. Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 wow thanks!!! lmao. The smallest clues always help lol. I newver thought to place $loser there lol. Thanks Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 You just got yourself in a muddle by the look of it. I could have told you straight off what the problem was but if you learn from your mistakes then your less likely to do it again. Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 wait. When i click, hopitilize or something, im getting the message, cheaters get nowhere :/ Thats coming error is rooting from the attack.php script i think, but the message itself is coming from attackbeat.php ect ect... Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 I dont use that system but probably from the ID being empty Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 but the user id bit in the url SHOULD NOT be empty. that fact that '$loser' is there, that should make the person you are attackings ID there. Shouldnt it? Because wen im getting the cheaters get nowhere thing, the URL is http://*******.com/attackwon.php. Shouldnt that be ...won.php?ID=X? Thats where i need the help here :/ Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 That would depend if you have changed the attack file correctly ;) Check if the ID is being passed on the next file. IE echo the ID see if it comes up as the ID or 0 Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 Well i changed something, the 3 lines are now: <form action="attackwon.php?ID=$loser"'. $loser .' method="post"><input type="submit" value="Mug them"> <form action="attackbeat.php?ID=$loser"'. $loser .' method="post"><input type="submit" value="Hospitalize them"> <form action="attacktake.php?ID=$loser"'. $loser .' method="post"><input type="submit" value="Leave them"> But the URL seems to be going: ...attackwon.php?ID=$loser Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 Well that would be your problem then. Think why would you need to specify $loser twice in that form url. Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 Hmmm. I get were your going... So i removed the second : '. $loser .' parts, but still the same error... Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 So close but no banana! You removed the wrong $loser Quote Link to comment Share on other sites More sharing options...
Paddy Posted August 12, 2010 Share Posted August 12, 2010 Well same here i don't use this script but i don't know why you are using $loser for the users ID never mind i missed abit ^^ Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 12, 2010 Share Posted August 12, 2010 <form action="attackwon.php?ID='. $loser .' method="post"> Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 12, 2010 Author Share Posted August 12, 2010 Right. Im lost. Can someone post the full working scrpt please? Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted August 13, 2010 Share Posted August 13, 2010 Thats not your solution. Even McCodes states you need to know basic php which if you did then you would be able to fix it. There is nothing bad about getting it wrong your just not even ready to try. Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted August 13, 2010 Author Share Posted August 13, 2010 But shouldnt '$loser' make it the user ID? Quote Link to comment Share on other sites More sharing options...
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.