Oo-Savage-oO Posted December 22, 2010 Share Posted December 22, 2010 I am using Immortalthugs atta.ph with a few modifications of my own but i get a error plz help here is the code <?php $menuhide=1; $atkpage=1; require_once("globals.php"); $$_GET['ID'] == (int) $_GET['ID']; if(!$_GET['ID']) { print "WTF you doing, bro?"; $h->endpage(); exit; } $energy = $ir['maxenergy']/4; $error = ($ir['hp'] <= 0) ? "You can't attack someone when you have no health!" : $error; $error = ($ir['energy']<$energy) ? "You need to have at least 25% of your energy if you want to attack someone." : $error; $error = ($ir['jail'] > 0) ? "You can't attack someone if you are in jail." : $error; $error = ($ir['hospital'] > 0) ? "You can't attack someone if you are in the hospital." : $error; $error = ($_GET['ID'] == "") ? "You didn't choose someone to attack." : $error; $error = ($_GET['ID'] == $ir['userid']) ? "You can't attack yourself." : $error; if($ir['equip_armor'] > 0) { $yourarmorstuff = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$ir['equip_armor'].")"); $dat = $db->fetch_row($yourarmorstuff); $defense = $dat['armor']; } else { $defense = 0; } $attacking_person = mysql_query("SELECT `u`.`userid`,`u`.`username`,`u`.`hp`,`u`.`maxhp`,`u`.`level`, " . "`u`.`money`,`u`.`location`,`u`.`hospital`,`u`.`jail`,`u`.`fedjail`,`u`.`gang`,`u`.`user_level`, " . "`u`.`equip_primary`,`u`.`equip_secondary`,`u`.`equip_armor`,`u`.`exp`,`us`.`strength`,`us`.`agility`, " . "`us`.`guard` " . "FROM `users` `u` " . "LEFT JOIN `userstats` `us` " . "ON `u`.`userid`=`us`.`userid` " . "WHERE (`u`.`userid`=".$_GET['ID'].")", $c) OR die(mysql_error()); $attack_person = mysql_fetch_array($attacking_person); $qo=$db->query("SELECT i.* FROM items i WHERE i.itmid={$_GET['wepid']}"); $r1=$db->fetch_row($qo); $primarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$attack_person['equip_primary'].""); $ouch = $db->fetch_row($primarydamage); $prim = ($attack_person['strength']+$ouch['weapon'])-($ir['guard']+$defense); // PRIMARY "weapon" Damage. $secondarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$attack_person['equip_secondary'].""); $ouchy = $db->fetch_row($secondarydamage); $second = ($attack_person['strength']+$ouchy['weapon'])-($ir['guard']+$defense); // Secondary "weapon" Damage. if($attack_person['equip_primary'] > 0) { $killer = $prim; } elseif($attack_person['equip_primary'] = 0 && $attack_person['equip_secondary'] > 0) { $killer = $second; } else { $killer = $attack_person['strength'] - $ir['guard']; } if($attack_person['equip_armor'] > 0) { $ayourarmorstuff = $db->query("SELECT * FROM `items` WHERE (`itmid`=".$attack_person['equip_armor'].")"); $adat = $db->fetch_row($ayourarmorstuff); $adefense = $dat['armor']; } else { $defense = 0; } $aprimarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_primary'].""); $winn = $db->fetch_row($aprimarydamage); $aprim = ($ir['strength']+$winn['weapon'])-($attack_person['guard']+$defense); // PRIMARY "weapon" Damage. $asecondarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_secondary'].""); $win = $db->fetch_row($asecondary); $secondd = ($ir['strength']+$win['weapon'])-($attack_person['guard']+$defense); // Secondary "weapon" Damage. if($ir['equip_primary'] > 0) { $killers = $aprim; } elseif($ir['equip_primary'] = 0 && $ir['equip_secondary'] > 0) { $killers = $secondd; } else { $killers = $ir['strength'] - $ir['guard']; } if($attack_person['equip_primary'] > 0 && $attack_person['equip_secondary'] > 0) { $killer = ($ouch['weapon']+$ouchy['weapon']+$attack_person['strength'])-($ir['guard']+$defense); $wepname = "".$ouch['itmname']." and their ".$ouchy['itmname'].""; } elseif($attack_person['equip_primary'] > 0 && $attack_person['equip_secondary'] = 0) { $killer = ($ouch['weapon']+$attack_person['strength'])-($ir['guard']+$defense); $wepname = "".$ouch['itmname'].""; } elseif($attack_person['equip_primary'] = 0 && $attack_person['equip_secondary'] > 0) { $killer = ($ouchy['weapon']+$attack_person['strength']) - ($ir['guard']+$defense); $wepname = "".$ouch['itmname'].""; } else { $killer = $attack_person['strength']-($ir['guard']+$defense); $wepname = Fists; } $aprimarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_primary'].""); $winn = $db->fetch_row($aprimarydamage); $asecondarydamage = $db->query("SELECT * FROM `items` WHERE `itmid`=".$ir['equip_secondary'].""); $win = $db->fetch_row($asecondary); if($ir['equip_primary'] > 0 AND $ir['equip_primary'] > 0) { $killers = ($winn['weapon']+$win['weapon']+$ir['strength'])-($attack_person['guard']+$adefense); $aweap = "".$winn['itmname']." and their ".$win['itmname'].""; } elseif($ir['equip_primary'] > 0 && $ir['equip_secondary'] == 0) { $killers = ($winn['weapon']+$ir['strength'])-($attack_person['guard']+$adefense); $aweap = "".$winn['itmname'].""; } elseif($ir['equip_primary'] == 0 && $ir['equip_secondary'] > 0) { $killers = ($win['weapon']+$ir['strength']) - ($attack_person['guard']+$adefense); $aweap = "".$win['itmname'].""; } else { $killers = $ir['strength'] - ($attack_person['guard']+$defense); $aweap = Fists; } if(!mysql_num_rows($attacking_person)) { echo "Invalid User Selected to attack."; $h->endpage(); exit; } $error = ($attack_person['location'] != $ir['location']) ? "You must be in the same city as the person you are attacking. Duh." : $error; $error = ($attack_person['username'] == "") ? "That person doesn't exist." : $error; $error = ($attack_person['hospital'] > 0) ? "You can't attack someone that is in the hospital." : $error; $error = ($attack_person['jail'] > 0) ? "You can't attack someone that is in jail." : $error; $error = ($ir['level'] > 5 && $attack_person['level'] < 6) ? "You can't attack someone that is level 5 or below because you are higher than level 5." : $error; $error = ($ir['gang'] == $attack_person['gang'] AND $ir['gang'] != 0) ? "You cant attack someone in the same clan as yourself!" : $error; $error = ($attack_person['hp'] <= 0) ? "This person has no health at the moment." : $error; $error = ($attack_person['fedjail'] > 1) ? "This person is in fed and cannot be attacked." : $error; $error = ($attack_person['user_level'] == 2) ? "Admins Cannot be attacked." : $error; if (isset($error)){ echo "".htmlentities(stripslashes($error)).""; $h->endpage(); exit; } $yourhp = $ir['hp']; $theirhp = $attack_person['hp']; echo "<center>Fight House</center> <center><font color=white>You are in a fight with ".$attack_person['username'].".</center> "; $wait = ($ir['agility'] > $attack_person['agility']) ? 1 : 0; while($yourhp > 0 && $theirhp > 0) { $damage = $killer; $damage = ($damage < 1) ? 1 : $damage; if($wait == 0) { $yourhp = $yourhp - $damage; echo "<font color=white><center> " . $attack_person['username'] . " hit you for " . $damage . " damage using their Fists. </center>"; // WEAPON STUFF HERE LATER. } else { $wait = 0; } if($yourhp > 0) { $damage = $killers; $damage = ($damage < 1) ? 1 : $damage; $theirhp = $theirhp - $damage; echo "<font color=white><center> You hit " . $attack_person['username'] . " for " . $damage . " damage using your Using your {$r1['itmname']} </center> "; } if($theirhp <= 0){ // ATTACKER WINS AND UPDATES $winner = $ir['userid']; $theirhp = 0; $moneywon = floor($attack_person['money'] /10); $expwon = 150 - (25 * ($ir['level'] - $attack_person['level'])); $expwon = ($expwon < 0) ? 0 : $expwon; $newexp = $expwon + $ir['exp']; $newmoney = $ir['money'] + $moneywon; $result = mysql_query("UPDATE `users` SET `exp` = ".$newexp.", money = ".$newmoney." WHERE (`userid`=".$ir['userid'].")", $c) or die(mysql_error()); $newmoney = $attack_person['money'] - $moneywon; $result = mysql_query("UPDATE `users` SET `money` = ".$newmoney.", `hospital` = 30 WHERE (`userid`=".$attack_person['userid'].")", $c) or die(mysql_error()); event_add($attack_person['userid'], "You were hospitalized by ".$ir['username']." for 20 minutes."); echo "<font color=white><center>You hospitalized " . $attack_person['username'] . ". You gain $expwon exp and stole $".$moneywon." from " . $attack_person['username'] . ".</center>"; } if($yourhp <= 0){ // DEFENDER WINS AND UPDATES $winner = $attack_person['userid']; $yourhp = 0; $moneywon = floor($ir['money'] /10); $expwon = 100 - (25 * ($attack_person['level'] - $ir['level'])); $expwon = ($expwon < 0) ? 0 : $expwon; $newexp = $expwon + $attack_person['exp']; $newmoney = $attack_person['money'] + $moneywon; $result = mysql_query("UPDATE `users` SET `exp` = ".$newexp.", `money` = ".$newmoney." WHERE (`userid`=".$attack_person['userid'].")", $c) or die(mysql_error()); $newmoney = $ir['money'] - $moneywon; $result = mysql_query("UPDATE `users` SET `money` = '".$newmoney."',`hospital` = '20' WHERE (`userid`=".$ir['userid'].")", $c) or die(mysql_error()); event_add($ir['userid'], "You were hospitalized by ".$attack_person['username']." for 20 minutes."); echo "<center><font color=white>".$attack_person['username']." Hospitalized you and stole $".$moneywon." from you.</center>"; } } //UPDATE USERS $newenergy = $ir['energy'] - floor($ir['energy'] * .10); $result = mysql_query("UPDATE `users` SET `hp` = ".$theirhp." WHERE (`userid`=".$attack_person['userid'].")", $c) or die(mysql_error()); $result = mysql_query("UPDATE `users` SET `hp` = ".$yourhp.", `energy` = '".$newenergy."' WHERE (`userid`=".$ir['userid'].")", $c) or die(mysql_error()); echo "</td></tr>"; ?> QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query was SELECT i.* FROM items i WHERE i.itmid= I will be grateful to anyone who helps as this is a tough problem Quote Link to comment Share on other sites More sharing options...
Equinox Posted December 22, 2010 Share Posted December 22, 2010 $r1 = $db->fetch_row($db->query("SELECT * FROM `items` WHERE (`itmid` = ".$_GET['wepid'].")")); That'll do it. Not recommended that you select everything from `items` when you're not using all of it. Quote Link to comment Share on other sites More sharing options...
Danny696 Posted December 22, 2010 Share Posted December 22, 2010 ImmoralThug, need I say more. His codes are always full of nice little bug's Quote Link to comment Share on other sites More sharing options...
Oo-Savage-oO Posted December 22, 2010 Author Share Posted December 22, 2010 Oh thanks that bit was unused so i deleted it anyway +1 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.