bladewolf2010 Posted May 17, 2010 Share Posted May 17, 2010 <?php $atkpage=1; include "globals.php"; if ($_GET[buying]) { $_GET[buying]=mysql_safe($_GET[buying]); $_GET[iD]=mysql_safe($_GET[iD]); $qry="select * from userflags where attacking={$_GET[iD]}"; $busy=$db->query($qry); $bsy2=($db->fetch_row($busy)); if ($_GET[buying]!=$bsy2[time]) { die ("<font color=royalblue>Error in purchase, Are you using real money ??"); } if($ir[money]<=15000) { die ("<font color=royalblue>Insufficient money in your pocket to purchase fight"); } mysql_query("update users set money=money-15000 where userid=$userid"); mysql_query("update users set level=level-1 where userid=$bsy2[userid] and level>0"); mysql_query("delete from userflags where attacking={$_GET[iD]}"); Print " <font color=royalblue> You have paid \$15,000 and purchased rights to fight this user. The other attacker has lost a level for holding the fight open."; event_add($bsy2['userid'],"You have been deducted one level for holding a fight open until it has gone stale. Soemone purchased the fight"); $h->endpage(); exit; } $qry="select * from userflags where userid=$userid"; $att=$db->query($qry); $atta=0; if (mysql_num_rows($att)!=0) { $at2=($db->fetch_row($att)); Print "Unfinished attack on userid {$at2['attacking']}, Switching attack to this player. "; $_GET['ID']=$at2['attacking']; $atta=1; } else { $qry="select * from userflags where attacking={$_GET[iD]}"; $busy=$db->query($qry); if (mysql_num_rows($busy)!=0) { $bsy2=($db->fetch_row($busy)); Print " Player $_GET[iD] is busy "; $tim=(time()-901); if ($bsy2['time']<=$tim) { Print "<a href=attack.php?buying=$bsy2[time]&ID=$_GET[iD]>Buy the fight for \$15,000</a>"; } $h->endpage(); exit; } 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. [url='index.php']Back[/url]"; $h->endpage(); exit; } else if ($_SESSION['attacklost'] == 1) { print "Only the losers of all their EXP attack when they've already lost. [url='index.php']Back[/url]"; $_SESSION['attacklost']=0; $h->endpage(); exit; } } //get player data $youdata=$ir; $_GET['ID']=mysql_safe($_GET['ID']); $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. [url='index.php']Back[/url]"; $_SESSION['attacklost']=0; $h->endpage(); exit; } if($ir['hp'] == 0 and $_SESSION['attacking']) { mysql_query("UPDATE users SET hospital=300,hospreason='Tried to run from {$odata['username']}' where userid=$userid", $c); print "<center>No Refreshing! [url='index.php']> Back [/url]</center>"; $h->endpage(); $_SESSION['attacking']=0; exit; } //if($odata['userpass'] == 'd41d8cd98f00b204e9800998ecf8427e') //{ // print "This is a bot, please attack using the Ally Way. // [url='index.php']> Back[/url]"; // $h->endpage(); // $_SESSION['attacking']=0; // $ir['attacking']=0; // $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); // exit; //} if($odata['hp'] == 1) { print "<font color=royalblue>This player is unconscious. [url='index.php']><font color=royalblue> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } if($odata['fedjail'] == 1) { print "<font color=royalblue>This player is in fedjail and cannot be attacked. [url='index.php']> <font color=royalblue>Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['hospital']) { print "<font color=royalblue>This player is in hospital. [url='index.php']><font color=royalblue> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['court']) { print "<font color=red>You cannot attack people that are in court!</font> [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['hospital']) { print "<font color=royalblue>While in hospital you can't attack. [url='hospital.php']> <font color=royalblue>Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['jail']) { print "<font color=royalblue>This player is in jail. [url='index.php']> <font color=royalblue>Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($ir['jail']) { print "<font color=royalblue>While in jail you can't attack. [url='jail.php']> <font color=royalblue>Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } else if($odata['travelling']) { print "<font color=royalblue>That player is travelling. [url='index.php']> <font color=royalblue>Back[/url]"; $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={$odata['userid']} WHERE userid=$userid"); if ($_GET['nextstep'] && $atta==0) { $db->query("insert into userflags (userid,attacking,time) values ('$userid','$odata[userid]',unix_timestamp())"); } $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; //damage if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary']) { print "<font color=royalblue>Stop trying to abuse a game bug. You can lose all your EXP for that. [url='index.php']> <font color=royalblue>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']}"); print "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font> \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> \n"; } else { print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font> \n"; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font> \n"; } if($odata['hp'] <= 0) { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; $db->query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}"); print " [b]What do you want to do with {$odata['username']} now?[/b] <form action='attackwon.php?ID={$_GET['ID']}' method='post'><font color=royalblue><input type='submit' value='Mug Them' /></form> <form action='attackbeat.php?ID={$_GET['ID']}' method='post'><font color=royalblue><input type='submit' value='Hospitalize Them' /></form> <form action='attacktake.php?ID={$_GET['ID']}' method='post'><font color=royalblue><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> \n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font> \n"; } else { $ns=$_GET['nextstep']+1; print "<font color=red>{$ns}. {$odata['username']} tried to hit you but missed ({$youdata['hp']})</font> \n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font> \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 "<font color=royalblue>You can only attack those who have health </table>"; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { print "<font color=royalblue>You are in the same gang as {$odata['username']}! What are you smoking today dude! </table>"; $h->endpage(); exit; }else if ($ir['team'] == $odata['team'] && $ir['team']) { print "<font color=royalblue>You are in the same team as {$odata['username']}! What are you doing man!"; exit; } else if ($youdata['energy'] < $youdata['maxenergy']/2) { print "<font color=royalblue>You can only attack someone when you have 50% energy </table>"; $h->endpage(); exit; } else if ($youdata['location'] != $odata['location']) { print "<font color=royalblue>You can only attack someone in the same location! </table>"; $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: "; 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 "[url='attack.php?nextstep=$ns&ID={$_GET[']{$r['itmname']}[/url] "; } } else { print "<font color=royalblue>You have nothing to fight with."; } print "</table>"; print "<table width='50%' align='center'><tr><td align=right><font color=royalblue>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 Link to comment Share on other sites More sharing options...
Spudinski Posted May 17, 2010 Share Posted May 17, 2010 There is no definition of any query that would update the user's experience. Use the default script, or add the default query to this(current) script. Quote Link to comment Share on other sites More sharing options...
bladewolf2010 Posted May 17, 2010 Author Share Posted May 17, 2010 Whats your script? 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.