boozer Posted January 30, 2011 Posted January 30, 2011 Does anyone know why my attak page would be looking like this ? Quote
lucky3809 Posted January 30, 2011 Posted January 30, 2011 either you didnt close the div tags or the table. dont know you didnt post the code. but by the looks of it a tag wasnt closed properly. Quote
mr_shuu Posted February 10, 2011 Posted February 10, 2011 My few players complain about the attack page. When they fight the npcs? battlebots... the bots are equiped with weapons and armor but in fight it says that the NPCs? are beating them with bare hands. Any idea what area I need to focus on? <?php $atkpage=1; include 'globals.php'; $_GET['ID'] = (isset($_GET['ID']) && ($_GET['ID'])) ? intval($_GET['ID']) : false; $_GET['wepid'] = (isset($_GET['wepid']) && ($_GET['wepid'])) ? intval($_GET['wepid']) : false; $_GET['nextstep'] = (isset($_GET['nextstep']) && ($_GET['nextstep'])) ? intval($_GET['nextstep']) : false; $_GET['hp'] = (isset($_GET['hp']) && ($_GET['hp'])) ? intval($_GET['hp']) : false; $_GET['attacklost'] = (isset($_GET['attacklost']) && ($_GET['attacklost'])) ? intval($_GET['attacklost']) : false; $_GET['attacking'] = (isset($_GET['attacking']) && ($_GET['attacking'])) ? intval($_GET['attacking']) : false; $_GET['maxhp'] = (isset($_GET['maxhp']) && ($_GET['maxhp'])) ? intval($_GET['maxhp']) : false; if(!$_GET['ID']) { echo'No ID selected.'; exit($h->endpage()); } if(!$_GET['ID']) { echo 'WTF you doing, bro?'; exit($h->endpage()); } else if($_GET['ID'] == $userid) { echo 'Stop beating up on yourself. It was a long time ago and probably not your fault.'; exit($h->endpage()); } else if ($ir['hp'] <= 1) { echo 'I will say this. You show determination [url="index.php"]Back[/url]'; exit($h->endpage()); } else if ($_SESSION['attacklost'] == 1) { echo "Stay down you can not beat this son of a bitch. [url='index.php']Back[/url]"; $_SESSION['attacklost']=0; exit($h->endpage()); } //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']) { echo 'Bad, bad, bad girl. [url="index.php"]Back[/url]'; $_SESSION['attacklost']=0; exit($h->endpage()); } if($odata['hp'] == 1) { echo 'This player is unconscious and has pissed themselves. [url="index.php"]> Back[/url]'; exit($h->endpage()); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['hospital']) { echo 'This player is in hospital. [url="index.php"]> Back[/url]'; exit($h->endpage()); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['hospital']) { echo 'While in hospital you can\'t attack. [url="hospital.php"]> Back[/url]'; exit($h->endpage()); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['jail']) { echo 'This player is in Solitary Confinement. They are probably hiding from you. [url="index.php"]> Back[/url]'; exit($h->endpage()); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['jail']) { echo 'While in Solitary Confinement you can not beat on others but you can beat yourself off. [url="jail.php"]> Back[/url]'; exit($h->endpage()); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['travelling']) { echo 'That player is travelling. [url="index.php"]> Back[/url]'; exit($h->endpage()); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } echo '<table width=100%><tr><td colspan=2 align=center>'; if($_GET['wepid']) { if($_SESSION['attacking']==0 && $ir['attacking'] == 0) { if ($youdata['energy'] >= $youdata['maxenergy']/4) { $youdata['energy']-= floor($youdata['maxenergy']/4); $me=floor($youdata['maxenergy']/4); $db->query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid"); $_SESSION['attacklog']=""; $_SESSION['attackdmg']=0; } else { echo 'You can only attack someone when you have 25% energy, a song in your heart and a maniacal grin.'; exit($h->endpage()); } } $_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']; if($_GET['nextstep'] > 25) { print "<center>This fight is going nowhere you may as well go home and look at porn or contact Troy and ask him how to exploit weakness in this facility! [url='index.php'] Back[/url]</center>"; exit($h->endpage()); event_add($odata['userid'],"[url='viewuser.php?u=$userid']{$youdata['username']}[/url] Tried to beat you but stalemated.",$c); exit; } if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary']) { echo 'Stop trying to abuse a game bug. One Troy is enough for any RPG. Badass will murder you that. [url="index.php"]> Home[/url]'; $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']}"); echo '<span style="color: red;">'. number_format($_GET['nextstep']) .'. Using your '. $r1['itmname'] .' you hit '.$odata['username'].' doing '.$mydamage.' damage ('. number_format($odata['hp']) .')</span> '; $_SESSION['attackdmg']+=$mydamage; $_SESSION['attacklog'] .= '<span style="color: red;">'. number_format($_GET['nextstep']) .'. Using your '. $r1['itmname'] .' you hit '. $odata['username'] .' doing '. $mydamage .' damage '. number_format($odata['hp']) .'</span> '; } else { echo '<span style="color: red;">'. number_format($_GET['nextstep']) .'. You tried to hit '. $odata['username'] .' but missed ('. number_format($them['hp']) .')</span> '; $_SESSION['attacklog'] .= '<span style="color: red;">'. number_format($_GET['nextstep']) .'. You tried to hit '. $odata['username'] .' but missed ('. number_format($odata['hp']) .')</span> '; } if($odata['hp'] <= 0) { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; $db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}"); echo ' [b]What do you want to do with '.$odata['username'].' now?[/b] <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; echo '<span style="color: red;">'.$ns.'. Using '.$oabbr.' '.$wep.' '.$odata['username'].' hit you doing '.$dam.' damage '.($youdata['hp']).'</span> '; $_SESSION['attacklog'].='<span style="color: blue;">'.$ns.'. Using '.$oabbr.' '.$wep.' '.$odata['username'].' hit '.$ir['username'].' doing '.$dam.' damage '.($youdata['hp']).'</span> '; } else { $ns=$_GET['nextstep']+1; echo '<span style="color: red;">'.$ns.'. '.$odata['username'].' tried to hit you but missed '.($youdata['hp']).'</font> '; $_SESSION['attacklog'].='<span style="color: blue;">'.$ns.'. '.$odata['username'].' tried to hit '.$ir['username'].' but missed '.($youdata['hp']).'</span> '; } if($youdata['hp'] <= 0) { $youdata['hp']=0; $_SESSION['attacklost']=1; $db->query("UPDATE users SET hp=0 WHERE userid=$userid"); echo '<form action="attacklost.php?ID='.$_GET['ID'].'"method="post"><input type="submit" value="Continue" />'; } } } else if ($odata['hp'] < 5) { echo 'You can only attack those who have health'; exit($h->endpage()); } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { echo 'You are in the same gang as '.$odata['username'].'! What are you smoking today dude!'; exit($h->endpage()); } else if ($youdata['energy'] < $youdata['maxenergy']/4) { echo 'You can only attack someone when you have 25% energy, and you feel divinely inspired. '; exit($h->endpage()); } else if ($youdata['location'] != $odata['location']) { echo 'You can only attack someone in the same location!'; exit($h->endpage()); } else { } echo '</td></tr>'; if($youdata['hp'] <= 0 || $odata['hp'] <= 0) { echo '</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']})"); echo '<tr><td colspan=2 align="center">Attack with: '; 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']) { echo '[b]Primary Weapon:[/b] '; } if($r['itmid']==$ir['equip_secondary']) { echo '[b]Secondary Weapon:[/b] '; } echo "[url='attack.php?nextstep=$ns&ID={$_GET[']{$r['itmname']}[/url] "; } } else { echo 'You have nothing to fight with.'; } echo '</table>'; echo "<table ALIGN=RIGHT width='169' cellpadding='0' cellspacing='0'> <tr> <td width='40' height='40' background='block_03.jpg'><center>[b]{$odata['username']} Health[/b]</td></tr><tr> <td width='40' background='block_03.jpg' valign='top'><center><img src=greenbar.png width={$vars2['hpperc']} height=10><img src=redbar.png width={$vars2['hpopp']} height=10> [img={$odata[] <tr> <td width='40' height='40' height='40' background='block_03.jpg'><center></td></tr><tr><td> </td></tr> <tr> <table ALIGN=LEFT width='169' cellpadding='0' cellspacing='0'> <tr> <td width='40' height='40' background='block_03.jpg'><center>[b]{$ir['username']} Health:[/b]</td></tr><tr> <td width='40' background='block_03.jpg' valign='top'><center><img src=greenbar.png width={$vars['hpperc']} height=10><img src=redbar.png width={$vars['hpopp']} height=10> [img={$ir[]<tr> <td width='40' height='40' height='40' background='block_03.jpg'><center></td></tr><tr><td> </td></tr> <tr></table>"; } exit($h->endpage()); ?> Quote
Uridium Posted February 11, 2011 Posted February 11, 2011 Tested your script on my localhost and the bars were fine for me... 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.