<?php
$battle = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$user['battle'].'" LIMIT 1'));

$t1 = explode(";", $battle['t1']);
if(in_array($user['id'], $t1)) {
  $ttt = 1;
} else {
  $ttt = 2;
}

if($user['battle'] <= 0) {
  echo 'Это боевая магия ...';
} if($user['battle'] > 0 && $user['hp'] == $user['maxhp']) {
  echo 'Ваше здоровье, и так полное ...';
} elseif($user['battle'] > 0 && $user['hp'] <= 0) {
  echo 'Вы мертвы ...';
} else {
  if($user['invis'] == 1) { $lod = '<i><b>невидимка</b></i>'; } else { $lod = nick5($user['id'], "B".$ttt); }
  $hp = floor($user['maxhp']*0.5);
  addlog($battle['id'], '<span class=date>'.date("H:i").'</span> '.$lod.' использовал заклятие Воcстановление энергии 50%.<BR>');
  $user['hp'] += $hp;
  if($user['hp'] > $user['maxhp']) {
    $user['hp'] = $user['maxhp'];
  }
  mysql_query('UPDATE `users` SET `hp` = "'.$user['hp'].'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
  echo 'Успешно';
  $bet = 1;
}