Jump to content
MakeWebGames

Recommended Posts

Posted

ok for some reason on my game after beating a person and clicking on what you want to do with them (leave hosp or mug) after clicking it it performs that action but then it says the little you lost all your exp for running thing and takes away your exp. i can't find why, i can show you any lines of code you need and i really need help.

Posted

Re: always running from a fight

<?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.

Back";

$h->endpage();

exit;

}

else if ($_SESSION['attacklost'] == 1)

{

print "Only the losers of all their EXP attack when they've already lost.

Back";

$_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.

Back";

$_SESSION['attacklost']=0;

$h->endpage();

exit;

}

if($odata['hp'] == 1)

{

print "This player is unconscious.

> Back";

$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.

> Back";

$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.

> Back";

$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.

> Back";

$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.

> Back";

$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.

> Back";

$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']/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

{

print "You can only attack someone when you have 25% 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.

> Home";

$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);

$hit = Rand (70,75);

switch ($hit)

{

case 70:

$hitspot = 'Legs';

$img= '/home2/respect/public_html/legs.jpg';

break;

case 71:

$hitspot = 'Arm';

$img= '/home2/respect/public_html/arms.jpg';

break;

case 72:

$hitspot = 'Groin';

$img= '/home2/respect/public_html/groin.jpg';

break;

case 73:

$hitspot = 'Torso';

$img= '/home2/respect/public_html/torso.jpg';

break;

case 74:

$hitspot = 'Heart';

$img= '/home2/respect/public_html/heart.jpg';

break;

case 75:

$hitspot = 'Head';

$img= '/home2/respect/public_html/head.jpg';

}

$mydamage=(int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000) *(($hit*.015)*$youdata['will']/$youdata['maxwill']*100/$odata['will']*$odata['maxwill']*100/2.5));

$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 "<img src=$img height=300 width=225 alt=Repsected Mafia align=left> <font color=red>{$_GET['nextstep']}.Using your {$r1['itmname']} you hit {$odata['username']} in the $hitspot 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']} in the $hitspot doing $mydamage damage ({$odata['hp']})</font>

\n";

}

else

{

print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} in the $hitspot but missed ({$odata['hp']})</font>

\n";

$_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} in the $hitspot 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 "

What do you want to do with {$odata['username']} now?

<form action='attackwon.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Mug Them' align='center' /></form>

<form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' align='center' /></form>

<form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them'align='center' /></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;

global $db,$ir,$c,$h,$hitspot;

print "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you in the $hitspot 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 in the $hitspot 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 "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']/4)

{

print "You can only attack someone when you have 25% 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:

";

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 "Primary Weapon: ";

}

if($r['itmid']==$ir['equip_secondary'])

{

print "Secondary Weapon: ";

}

print "{$r['itmname']}

";

}

}

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();

?>

Posted

Re: always running from a fight

 

<?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.

[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;
$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($odata['hp'] == 1)
{
print "This player is unconscious.

[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($odata['hospital'])
{
print "This player is in hospital.

[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 "While in hospital you can't attack.

[url='hospital.php']> 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 "This player is in jail.

[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['jail'])
{
print "While in jail you can't attack.

[url='jail.php']> 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 "That player is travelling.

[url='index.php']> 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']/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
{
print "You can only attack someone when you have 25% 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.

[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);
$hit = Rand (70,75);
switch ($hit)
{
case 70:
$hitspot = 'Legs';
$img= '/home2/respect/public_html/legs.jpg';
break;
case 71:
$hitspot = 'Arm';
$img= '/home2/respect/public_html/arms.jpg';
break;
case 72:
$hitspot = 'Groin';
$img= '/home2/respect/public_html/groin.jpg';
break;
case 73:
$hitspot = 'Torso';
$img= '/home2/respect/public_html/torso.jpg';
break;
case 74:
$hitspot = 'Heart';
$img= '/home2/respect/public_html/heart.jpg';
break;
case 75:
$hitspot = 'Head';
$img= '/home2/respect/public_html/head.jpg';
}
$mydamage=(int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000) *(($hit*.015)*$youdata['will']/$youdata['maxwill']*100/$odata['will']*$odata['maxwill']*100/2.5));
$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 ==  { $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 "<img src=$img height=300 width=225 alt=Repsected Mafia align=left> <font color=red>{$_GET['nextstep']}.Using your {$r1['itmname']} you hit {$odata['username']} in the $hitspot 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']} in the $hitspot doing $mydamage damage ({$odata['hp']})</font>
\n";
}
else
{
print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} in the $hitspot but missed ({$odata['hp']})</font>
\n";
$_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} in the $hitspot 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'><input type='submit' value='Mug Them' align='center' /></form>
<form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' align='center' /></form>
<form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them'align='center' /></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 ==  { $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;
global $db,$ir,$c,$h,$hitspot;
print "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you in the $hitspot 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 in the $hitspot 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 "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']/4)
{
print "You can only attack someone when you have 25% 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:
";
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 "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();
?>
Posted

Re: always running from a fight

Nope.

While looking similar, the if statement is not the place to put unset :P

Oh..

I'd replace that if statement with

if(!isset($_SESSION['attacking']) && !$ir['attacking'])

While making no difference to what you see, the code like it better :P

Posted

Re: always running from a fight

well i did that on file

attack

attackbeat

attackwon

attacktake

attacklost

i'll double check to see if i missed one

Posted

Re: always running from a fight

ok. still getting the error. heres my new code for attack.php

<?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.

[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;
$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($odata['hp'] == 1)
{
print "This player is unconscious.

[url='index.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
$ir['attacking']=0;
$db->query("UPDATE users SET attacking=0 WHERE userid=$userid");
exit;
}
else if($odata['hospital'])
{
print "This player is in hospital.

[url='index.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
$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.

[url='hospital.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
$ir['attacking']=0;
$db->query("UPDATE users SET attacking=0 WHERE userid=$userid");
exit;
}
else if($odata['jail'])
{
print "This player is in jail.

[url='index.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
$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.

[url='jail.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
$ir['attacking']=0;
$db->query("UPDATE users SET attacking=0 WHERE userid=$userid");
exit;
}
else if($odata['travelling'])
{
print "That player is travelling.

[url='index.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
$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(!isset($_SESSION['attacking']) && !$ir['attacking'])
{
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
{
print "You can only attack someone when you have 25% 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.

[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);
$hit = Rand (70,75);
switch ($hit)
{
case 70:
$hitspot = 'Legs';
$img= '/home2/respect/public_html/legs.jpg';
break;
case 71:
$hitspot = 'Arm';
$img= '/home2/respect/public_html/arms.jpg';
break;
case 72:
$hitspot = 'Groin';
$img= '/home2/respect/public_html/groin.jpg';
break;
case 73:
$hitspot = 'Torso';
$img= '/home2/respect/public_html/torso.jpg';
break;
case 74:
$hitspot = 'Heart';
$img= '/home2/respect/public_html/heart.jpg';
break;
case 75:
$hitspot = 'Head';
$img= '/home2/respect/public_html/head.jpg';
}
$mydamage=(int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000) *(($hit*.015)*$youdata['will']/$youdata['maxwill']*100/$odata['will']*$odata['maxwill']*100/2.5));
$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 "<img src=$img height=300 width=225 alt=Repsected Mafia align=left> <font color=red>{$_GET['nextstep']}.Using your {$r1['itmname']} you hit {$odata['username']} in the $hitspot 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']} in the $hitspot doing $mydamage damage ({$odata['hp']})</font>
\n";
}
else
{
print "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} in the $hitspot but missed ({$odata['hp']})</font>
\n";
$_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} in the $hitspot 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'><input type='submit' value='Mug Them' align='center' /></form>
<form action='attackbeat.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Hospitalize Them' align='center' /></form>
<form action='attacktake.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Leave Them'align='center' /></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;
global $db,$ir,$c,$h,$hitspot;
print "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you in the $hitspot 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 in the $hitspot 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 "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']/4)
{
print "You can only attack someone when you have 25% 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:
";
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 "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();
?> 
Posted

Re: always running from a fight

attack.php

<?php
$menuhide = 1;
$atkpage = 1;
include(DIRNAME(__FILE__) . '/globals.php');
$_GET['ID'] = abs(@intval($_GET['ID']));
if(!$_GET['ID'])
{
echo "WTF you doing, bro?";
$h->endpage();
exit;
}
if($_GET['ID'] == $userid)
{
echo "Only the crazy attack themselves.";
$h->endpage();
exit;
}
if($ir['hp'] <= 1)
{
echo "Only the crazy attack when their unconscious.

[url='index.php']Back[/url]";
$h->endpage();
exit;
}
if(isset($_SESSION['attacklost']))
{
echo "Only the losers of all their EXP attack when they've already lost.

[url='index.php']Back[/url]";
unset($_SESSION['attacklost']);
$h->endpage();
exit;
}
//get player data
$youdata = $ir;
$sql = sprintf(
"SELECT u.*, us.* " .
"FROM users u " .
"LEFT JOIN userstats us ON (u.userid = us.userid) " .
"WHERE (u.userid = %u)", $_GET['ID']);
$q = $db->query($sql);
if(!$db->num_rows($q))
{
echo "User does not exist!";
$h->endpage();
exit;
}
$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]";
unset($_SESSION['attacklost']);
$h->endpage();
exit;
}

if($odata['hp'] == 1)
{
echo "This player is unconscious.

[url='index.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
unset($ir['attacking']);
$update = sprintf("UPDATE users SET attacking = 0 WHERE (userid = %u)", $userid);
$db->query($update);
exit;
}
if($odata['hospital'])
{
echo "This player is in hospital.

[url='index.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
unset($ir['attacking']);
$update = sprintf("UPDATE users SET attacking = 0 WHERE (userid = %u)", $userid);
$db->query($update);
exit;
}
else if($ir['hospital'])
{
echo "While in hospital you can't attack.

[url='hospital.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
unset($ir['attacking']);
$update = sprintf("UPDATE users SET attacking = 0 WHERE (userid = %u)", $userid);
$db->query($update);
exit;
}
else if($odata['jail'])
{
echo "This player is in jail.

[url='index.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
unset($ir['attacking']);
$update = sprintf("UPDATE users SET attacking = 0 WHERE (userid = %u)", $userid);
$db->query($update);
exit;
}
else if($ir['jail'])
{
echo "While in jail you can't attack.

[url='jail.php']> Back[/url]";
$h->endpage();
unset($_SESSION['attacking']);
unset($ir['attacking']);
$update = sprintf("UPDATE users SET attacking = 0 WHERE (userid = %u)", $userid);
$db->query($update);
exit;
}
echo "<table width='100%'>";
echo "<tr>";
echo "<td colspan='2' align='center'>";
if(isset($_GET['wepid']))
{
if(!isset($_SESSION['attacking']) && !$ir['attacking'])
{
if($youdata['energy'] >= $youdata['maxenergy']/4)
{
$youdata['energy']-= floor($youdata['maxenergy']/4);
$me = floor($youdata['maxenergy']/4);
$energy = sprintf("UPDATE users SET energy = energy - %u WHERE (userid = %u)", $me, $userid);
$db->query($energy);
$_SESSION['attacklog'] = false;
$_SESSION['attackdmg'] = 0;
}
else
{
echo "You can only attack someone when you have 25% energy";
$h->endpage();
exit;
}
}
$_SESSION['attacking'] = 1;
$ir['attacking'] = $odata['userid'];
$attacking = sprintf("UPDATE users SET attacking = %u WHERE (userid = %u)", $ir['attacking'], $userid);
$db->query($attacking);
$_GET['wepid'] = abs(@intval($_GET['wepid']));
$_GET['nextstep'] = abs(@intval($_GET['nextstep']));
//damage

if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary'])
{
echo "Stop trying to abuse a game bug. You can lose all your EXP for that.

[url='index.php']> Home[/url]";
$noexp = sprintf("UPDATE users SET exp = 0 WHERE (userid = %u)", $userid);
$db->query($noexp);
$h->endpage();
exit;
}
$item = sprintf("SELECT * FROM items WHERE (itmid = %u)", $_GET['wepid']);
$qo = $db->query($item);
$r1 = $db->fetch_row($qo);
$hit = mt_rand(70,75);
switch ($hit)
{
case 70:
$hitspot = 'Legs';
$img= '/home2/respect/public_html/legs.jpg';
break;
case 71:
$hitspot = 'Arm';
$img= '/home2/respect/public_html/arms.jpg';
break;
case 72:
$hitspot = 'Groin';
$img= '/home2/respect/public_html/groin.jpg';
break;
case 73:
$hitspot = 'Torso';
$img= '/home2/respect/public_html/torso.jpg';
break;
case 74:
$hitspot = 'Heart';
$img= '/home2/respect/public_html/heart.jpg';
break;
case 75:
$hitspot = 'Head';
$img= '/home2/respect/public_html/head.jpg';
}
$mydamage = (int) (($r1['weapon'] * $youdata['strength'] / ($odata['guard'] / 1.5)) * (mt_rand(8000,12000) / 10000) * (($hit * .015) * $youdata['will'] / $youdata['maxwill'] * 100 / $odata['will'] * $odata['maxwill'] * 100 / 2.5));
$hitratio = max(10, min(60 * $ir['agility'] / $odata['agility'], 95));
if(mt_rand(1,100) <= $hitratio)
{
$armour = sprintf("SELECT armor FROM items WHERE (itmid = %u) ORDER BY RAND()", $odata['equip_armor']);
$q3 = $db->query($armour);
if($db->num_rows($q3))
{
$mydamage -= $db->fetch_single($q3);
}
if($mydamage < -100000) { $mydamage = abs($mydamage); }
else if($mydamage < 1) { $mydamage = 1; }
$crit = mt_rand(1,40);
if($crit == 17) { $mydamage *= mt_rand(20,40) / 10; }
else if($crit == 25) { $mydamage /= (mt_rand(20,40) / 10); } 
$mydamage = round($mydamage);
$odata['hp'] -= $mydamage;
if($odata['hp'] == 1) { $odata['hp'] = 0; $mydamage += 1; }
$updatehp = sprintf("UPDATE users SET hp = hp - %u WHERE (userid = %u)", $mydamage, $_GET['ID']);
$db->query($updatehp);
echo sprintf("[img=%s]", $img, $set['game_name']);
echo sprintf("<span style='color:red;'>%u. Using your %s, you hit %s in the %s doing %s damage (%s)</span>
", $_GET['nextstep'], stripslashes($r1['itmname']), stripslashes($odata['username']), $hitspot, number_format($mydamage), number_format($odata['hp']));
$_SESSION['attackdmg'] += $mydamage;
$_SESSION['attacklog'] .= sprintf("<span style='color:red;'>%u. Using %s %s, %s hit %s in the %s doing %s damage (%s)</span>
", $_GET['nextstep'], $myabbr, $r1['itmname'], $ir['username'], $odata['username'], $hitspot, number_format($mydamage), number_format($odata['hp']));
}
else
{
echo sprintf("<span style='color:red;'>%u. You tried to hit %s in the %s, but missed (%s)</span>
", $_GET['nextstep'], stripslashes($odata['username']), $hitspot, number_format($odata['hp']));
$_SESSION['attacklog'] .= sprintf("<span style='color:red;'>%u. %s tried to hit %s in the %s, but missed (%s)</span>
", $_GET['nextstep'], $ir['username'], $odata['username'], $hitspot, number_format($odata['hp']));
}

if($odata['hp'] <= 0)
{
$odata['hp'] = 0;
$_SESSION['attackwon'] = $_GET['ID'];

$nohp = sprintf("UPDATE users SET hp = 0 WHERE (userid = %u)", $_GET['ID']);
$db->query($nohp);
echo sprintf("
[b]What do you want to do with %s now?[/b]
", stripslashes($odata['username']));
echo sprintf("<form action='attackwon.php?ID=%u' method='post'><input type='submit' value='Mug Them' align='center' /></form>", $_GET['ID']);
echo sprintf("<form action='attackbeat.php?ID=%u' method='post'><input type='submit' value='Hospitalize Them' align='center' /></form>", $_GET['ID']);
echo sprintf("<form action='attacktake.php?ID=%u' method='post'><input type='submit' value='Leave Them'align='center' /></form>", $_GET['ID']);
}
else
{
//choose opp gun
$getweapon = sprintf("SELECT * FROM items WHERE (itmid IN(%u, %u))", $odata['equip_primary'], $odata['equip_secondary']);
$eq = $db->query($getweapon);
if(!$db->num_rows($eq))
{
$wep = "Fists";
$dam = (int)(((($odata['strength'] / $ir['guard'] / 100)) + 1) * (mt_rand(8000,12000) / 10000));
}
else
{
$cnt = 0;
while($r = $db->fetch_row($eq))
{
$enweps[] = $r;
$cnt ++;
}
$weptouse = mt_rand(0, $cnt-1);
$wep = $enweps[$weptouse]['itmname'];
$dam = (int) (($enweps[$weptouse]['weapon'] * $odata['strength'] / ($youdata['guard'] / 1.5)) * (mt_rand(8000,12000) / 10000));
}
$hitratio = max(10, min(60 * $odata['agility'] / $ir['agility'], 95));
if(mt_rand(1,100) <= $hitratio)
{
$getarmour = sprintf("SELECT armor FROM items WHERE (itmid = %u) ORDER BY RAND()", $ir['equip_armor']);
$q3 = $db->query($getarmour);
if($db->num_rows($q3))
{
$dam -= $db->fetch_single($q3);
}
if($dam < -100000) { $dam = abs($dam); }
else if($dam < 1) { $dam = 1; }
$crit = mt_rand(1,40);
if($crit == 17) { $dam *= mt_rand(20,40) / 10; }
else if($crit == 25) { $dam /= (mt_rand(20,40) / 10); } 
$dam = round($dam);
$youdata['hp'] -= $dam;
if($youdata['hp'] == 1) { $dam += 1; $youdata['hp'] = 0; }
$takehp = sprintf("UPDATE users SET hp = hp - %u WHERE (userid = %u)", $dam, $userid);
$db->query($takehp);
$ns = $_GET['nextstep'] + 1;
global $db,$ir,$c,$h,$hitspot;
echo sprintf("<span style='color:blue;'>%u. Using %s %s, %s hit you in the %s doing %s damage (%s)</span>
", $ns, $oabbr, stripslashes($wep), stripslashes($odata['username']), $hitspot, number_format($dam), number_format($youdata['hp']));
$_SESSION['attacklog'] .= sprintf("<span style='color:blue;'>%u. Using %s %s, %s hit %s doing %s damage (%s)</span>
", $ns, $oabbr, $wep, $odata['username'], $ir['username'], number_format($dam), number_format($youdata['hp']));
}
else
{
$ns = $_GET['nextstep'] + 1;
echo sprintf("<span style='color:red;'>%s. %s tried to hit you in the %s, but missed (%s)</span>
", $ns, stripslashes($odata['username']), $hitspot, number_format($youdata['hp']));
$_SESSION['attacklog'] .= sprintf("<span style='color:blue;'>%u. %s tried to hit %s, but missed (%s)</span>
", $ns, $odata['username'], $ir['username'], number_format($youdata['hp']));
}
if($youdata['hp'] <= 0)
{
$youdata['hp'] = 0;
$_SESSION['attacklost'] = 1;
$nohp = sprintf("UPDATE users SET hp = 0 WHERE (userid = %u)", $userid);
$db->query($nohp);
echo sprintf("<form action='attacklost.php?ID=%u' method='post'><input type='submit' value='Continue' />", $_GET['ID']);
}
}
}
else if($odata['hp'] < 5)
{
echo "You can only attack those who have health";
$h->endpage();
exit;
}
else if($ir['gang'] == $odata['gang'] && $ir['gang'] > 0)
{
echo sprintf("You are in the same gang as %s! What are you smoking today dude!", stripslashes($odata['username']));
$h->endpage();
exit;
}
else if($youdata['energy'] < $youdata['maxenergy']/4)
{
echo "You can only attack someone when you have 25% energy";
$h->endpage();
exit;
}
else if($youdata['location'] != $odata['location'])
{
echo "You can only attack someone in the same location!";
$h->endpage();
exit;
}
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'];

$selectweapons = sprintf("SELECT * FROM items WHERE (itmid IN(%u, %u))", $ir['equip_primary'], $ir['equip_secondary']);
$mw = $db->query($selectweapons);
echo "<tr><td colspan='2' align='center'>Attack with:
";
if($db->num_rows($mw))
{
while($r = $db->fetch_row($mw))
{
$ns = (!isset($_GET['nextstep'])) ? 1 : $_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 sprintf("[url='attack.php?nextstep=%u&ID=%u&wepid=%u']%s[/url]
", $ns, $_GET['ID'], $r['itmid'], stripslashes($r['itmname']));
}
}
else
{
echo "You have nothing to fight with.";
}
echo "</table>";
echo "<table width='50%' align='center'>";

echo "<tr>";
echo "<td align='right'>Your Health: </td>";
echo sprintf("<td>[img=greenbar.png][img=redbar.png]</td>", $vars['hpperc'], $vars['hpopp']);
echo "</tr>";

echo "<tr>";
echo "<td align='right'>Opponents Health: </td>";
echo sprintf("<td>[img=greenbar.png][img=redbar.png]</td>", $vars2['hpperc'], $vars2['hpopp']);
echo "</tr>";

echo "</table>";
}
$h->endpage();
?>

 

NOTICE: Untested

Posted

Re: always running from a fight

this sounds like an error in another page. Not the attack.php, but in the attackwon.php, attacklost.php, etc...

Basically, in the header.php if you are in a session attacking this case. And click a page you lose exp.

So what I "think" is the problem is somehow in the those pages. You have removed the spot to update it. It should be updating users attacking to 0. I believe that is where your problem lies.

Not in your attack.php..(Keep in mind I just read your problem i didnt look at your attack.php and this is just a thought.) Don't hold me to it lol.

Posted

Re: always running from a fight

 

this sounds like an error in another page. Not the attack.php, but in the attackwon.php, attacklost.php, etc...

Basically, in the header.php if you are in a session attacking this case. And click a page you lose exp.

So what I "think" is the problem is somehow in the those pages. You have removed the spot to update it. It should be updating users attacking to 0. I believe that is where your problem lies.

Not in your attack.php..(Keep in mind I just read your problem i didnt look at your attack.php and this is just a thought.) Don't hold me to it lol.

I've tested both my attack.php and his - I found no error.

It's probably a session overwrite from his old one..

Clearing cookies/cache should fix this :)

Posted

Re: always running from a fight

Yeah, I agree there. I seen you recoded it so I'm sure it's right. Probarly he/she changed something in the other attack files, and deleted the part to update attcking to 0. At least this is what it think lol

Posted

Re: always running from a fight

well i changed all things so that it says the whole $session attacking=0 is right on all the scripts except attack.php itself. and i cleared my cache/cookies and it didn't help. any ideas.

Posted

Re: always running from a fight

i'm looking and i see that while on the leave hosp mug page my attacking is in the 80's (on the mysql table)

and i u need it i can post any other atacking page scripts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...