"SELECT a.Defence FROM inventory iv LEFT JOIN items i ON iv.inv_itemid = i.itmid LEFT JOIN armour a ON i.itmid=a.item_ID WHERE i.itmtype=7 AND iv.inv_userid={$_GET['ID']} ORDER BY rand()",
$c);
if (mysql_num_rows($q3))
{
$mydamage -= mysql_result($q3, 0, 0);
}
if ($mydamage < 1)
{
$mydamage = 1;
}
$odata['hp'] -= $mydamage;
if ($odata['hp'] == 1)
{
$odata['hp'] = 0;
$mydamage += 1;
}
mysql_query(
"UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}",
$c);
print
"<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n";
$_SESSION['attacklog'] .=
"<font color=red>{$_GET['nextstep']}. Using his {$r1['itmname']}{$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font><br />\n";
}
else
{
print
"<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n";
$_SESSION['attacklog'] .=
"<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font><br />\n";
}
if ($odata['hp'] <= 0)
{
$odata['hp'] = 0;
$_SESSION['attackwon'] = $_GET['ID'];
mysql_query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}", $c);
"SELECT iv.*,i.*,w.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN weapons w ON iv.inv_itemid=w.item_id WHERE iv.inv_userid={$_GET['ID']} AND ( i.itmtype=3 OR i.itmtype=4 )",
"SELECT a.Defence FROM inventory iv LEFT JOIN items i ON iv.inv_itemid = i.itmid LEFT JOIN armour a ON i.itmid=a.item_ID WHERE i.itmtype=7 AND iv.inv_userid=$userid ORDER BY rand()",
$c);
if (mysql_num_rows($q3))
{
$dam -= mysql_result($q3, 0, 0);
}
if ($dam < 1)
{
$dam = 1;
}
$youdata['hp'] -= $dam;
mysql_query("UPDATE users SET hp=hp-$dam WHERE userid=$userid", $c);
$ns = $_GET['nextstep'] + 1;
print
"<font color=blue>{$ns}. Using his $wep{$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font><br />\n";
$_SESSION['attacklog'] .=
"<font color=blue>{$ns}. Using his $wep{$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font><br />\n";
}
else
{
$ns = $_GET['nextstep'] + 1;
print
"<font color=blue>{$ns}. {$odata['username']} tried to hit you but missed ({$youdata['hp']})</font><br />\n";
$_SESSION['attacklog'] .=
"<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font><br />\n";
}
if ($youdata['hp'] <= 0)
{
$youdata['hp'] = 0;
mysql_query("UPDATE users SET hp=0 WHERE userid=$userid", $c);