battle[$user['id']]);
if($us['sex'] == 1) {
addlog($user['battle'],''.date("H:i").' '.nick5($user['id'],'b').' вышла из боя!
');
} else {
addlog($user['battle'],''.date("H:i").' '.nick5($user['id'],'b').' вышел из боя!
');
}
$bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;'));
$battle = unserialize($bd['teams']);
//$ak = array_keys($battle[$user['id']]);
//$battle[$user['id']] = $battle[$ak[0]];
unset($battle[$user['id']]);
foreach($battle as $k => $v) {
unset( $battle[$user['id']][$k]);// =array(0,0,time());
unset( $battle[$k][$user['id']]);// = array(0,0,time());
}
$t1 = explode(";",$bd['t1']);
// проставляем кто-где
if (in_array ($user['id'],$t1)) {
$t1 = explode(";",$bd['t1']);
unset ($t1[array_search($user['id'],$t1)]);
$tu=$t1;
$ttt=1;
} else {
$t2 = explode(";",$bd['t2']);
unset ($t2[array_search($user['id'],$t2)]);
$tu=$t2;
$ttt=2;
}
mysql_query("UPDATE `inventory` SET `duration`=`duration`+1 WHERE `type` <>12 AND `dressed` = 1 AND `owner` = '{$user['id']}';");
$magictime=time()+(10*60);
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$user['id']."','Путы','$magictime',10);");
addchp ('Внимание! Вы вышли из боя! ','{[]}'.nick::id($user['id'])->short().'{[]}');
mysql_query("UPDATE `battle` SET `teams` = '".serialize($battle)."', `t".$ttt."`='".implode(";",$tu)."' WHERE `id` = ".$user['battle']." ;");
mysql_query('UPDATE users SET `battle` =0, `hp` = 0 WHERE `id` = '.$user['id'].';');
header("Location:fbattle.php");
$bet=1;
echo "Вы вышли из боя";
}
?>