$us=mysql_fetch_array(mysql_query("SELECT *, (SELECT `id` FROM `inventory` WHERE `owner` = `users`.`id` AND `name` LIKE '%Чеснок%' LIMIT 1) AS `che`, (SELECT `id` FROM `inventory` WHERE `owner` = `users`.`id` AND `name` LIKE '%Осиновый кол%' LIMIT 1) AS `kol`,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
$effs=mysql_query("SELECT * FROM `effects` WHERE `owner` = '{$us['id']}' and (`type`=12 or `type`=13 or `type`=14) limit 1;");
//echo
if($us['battle']){echo"Персонаж находится в поединке!";}
mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$us['id']."';");
mysql_query("UPDATE `users` SET `hp` = `hp`+'".((($user['maxhp']-$user['hp'])<=$us['hp'])?($user['maxhp']-$user['hp']):$us['hp'])."' WHERE `id` = '".$user['id']."';");
addch("<img src=i/magic/vampir.gif>{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию.");
mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$us['id']."';");
mysql_query("UPDATE `users` SET `hp` = `hp`+'".((($user['maxhp']-$user['hp'])<=$us['hp'])?($user['maxhp']-$user['hp']):$us['hp'])."' WHERE `id` = '".$user['id']."';");
addch("<img src=i/magic/vampir.gif>{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию.");
addch("<a href=logs.php?log=".$id." target=_blank>Бой</a> между <B><b>".nick7($user['id'])."</b> и <b>".nick7($us['id'])."</b> начался. ",$user['room']);
//mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." бросили вызов друг другу. <BR>');");
addlog($id,'Часы показывали <span class=date>'.date("Y.m.d H.i").'</span>, когда '.$rr.' бросили вызов друг другу. <BR>');
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']} OR `id` = {$us['id']}");
mysql_query("UPDATE `users` SET `hp` = 1 WHERE `id` = '".$us['id']."';");
mysql_query("UPDATE `users` SET `hp` = `hp`+'".((($user['maxhp']-$user['hp'])<=$us['hp'])?($user['maxhp']-$user['hp']):$us['hp'])."' WHERE `id` = '".$user['id']."';");
addch("<img src=i/magic/vampir.gif>{$golod} "{$user['login']}" {$action} на "{$target}" и {$pil} всю {$who} энергию.");