function startpod($who,$bot,$nomer,$user){
$query=mysql_query("SELECT id FROM users WHERE login='$who'");
$db=mysql_fetch_array($query);
$name2="";
$name3="";
if($bot=='1'){$name = "Паук"; $d1 = "Паук";}
else if($bot=='2'){$name = "Зомби"; $d1 = "Зомби";}
else if($bot=='3'){$name = "Жук"; $d1 = "Жук";}
else if($bot=='4'){$name = "Мерзость"; $d1 = "Мерзость";}
else if($bot=='5'){$name = "Обитатель"; $d1 = "Обитатель";}
else if($bot=='6'){$name = "Жуткий"; $d1 = "Жуткий";}
else if($bot=='7'){$name = "Мартын"; $d1 = "Мартын";}
else if($bot=='8'){$name = "Лука"; $d1 = "Лука";}
else if($bot=='11'){$name = "Гад Ползучий"; $d1 = "Гад Ползучий";}
else if($bot=='12'){$name = "Разлагающийся Труп"; $d1 = "Разлагающийся труп";}
else if($bot=='13'){$name = "Кровавый Сантехник"; $d1 = "Кровавый Сантехник";}
else if($bot=='14'){$name = "Канализационная Жуть"; $d1 = "Канализационная Жуть";}
//////////////////2 этаж/////////////////////
else if($bot=='9'){$name = "Крыса"; $d1 = "Крыса";}
else if($bot=='10'){$name = "Безголовый"; $d1 = "Безголовый";}
else if($bot=='1.1'){$name = "Паук"; $name2 = "Паук"; $d1 = "Паук(1)"; $d2 = "Паук(2)";}
else if($bot=='1.2'){$name = "Паук"; $name2 = "Зомби"; $d1 = "Паук"; $d2 = "Зомби";}
else if($bot=='1.3'){$name = "Паук"; $name2 = "Жук"; $d1 = "Паук"; $d2 = "Жук";}
else if($bot=='2.2'){$name = "Зомби"; $name2 = "Зомби"; $d1 = "Зомби(1)"; $d2 = "Зомби(2)";}
else if($bot=='2.3'){$name = "Зомби"; $name2 = "Жук"; $d1 = "Зомби"; $d2 = "Жук";}
else if($bot=='3.3'){$name = "Жук"; $name2 = "Жук"; $d1 = "Жук(1)"; $d2 = "Жук(2)";}
//////////////////2 этаж/////////////////////
else if($bot=='9.9'){$name = "Крыса"; $name2 = "Крыса"; $d1 = "Крыса(1)"; $d2 = "Крыса(2)";}
else if($bot=='10.10'){$name = "Безголовый"; $name2 = "Безголовый"; $d1 = "Безголовый(1)"; $d2 = "Безголовый(2)";}
else if($bot=='1.1.1'){$name = "Паук"; $name2 = "Паук"; $name3 = "Паук"; $d1 = "Паук(1)"; $d2 = "Паук(2)"; $d3 = "Паук(3)";}
else if($bot=='1.1.2'){$name = "Паук"; $name2 = "Паук"; $name3 = "Зомби"; $d1 = "Паук(1)"; $d2 = "Паук(2)"; $d3 = "Зомби";}
else if($bot=='1.1.3'){$name = "Паук"; $name2 = "Паук"; $name3 = "Жук"; $d1 = "Паук(1)"; $d2 = "Паук(2)"; $d3 = "Жук";}
else if($bot=='1.2.2'){$name = "Паук"; $name2 = "Зомби"; $name3 = "Зомби"; $d1 = "Паук"; $d2 = "Зомби(1)"; $d3 = "Зомби(2)";}
else if($bot=='1.3.2'){$name = "Паук"; $name2 = "Жук"; $name3 = "Зомби"; $d1 = "Паук"; $d2 = "Жук"; $d3 = "Зомби";}
else if($bot=='1.3.3'){$name = "Паук"; $name2 = "Жук"; $name3 = "Жук"; $d1 = "Паук"; $d2 = "Жук(1)"; $d3 = "Жук(2)";}
else if($bot=='2.2.2'){$name = "Зомби"; $name2 = "Зомби"; $name3 = "Зомби"; $d1 = "Зомби(1)"; $d2 = "Зомби(2)"; $d3 = "Зомби(3)";}
else if($bot=='2.2.3'){$name = "Зомби"; $name2 = "Зомби"; $name3 = "Жук"; $d1 = "Зомби(1)"; $d2 = "Зомби(2)"; $d3 = "Жук";}
else if($bot=='2.3.3'){$name = "Зомби"; $name2 = "Жук"; $name3 = "Жук"; $d1 = "Зомби"; $d2 = "Жук(1)"; $d3 = "Жук(2)";}
else if($bot=='3.3.3'){$name = "Жук"; $name2 = "Жук"; $name3 = "Жук"; $d1 = "Жук(1)"; $d2 = "Жук(2)"; $d3 = "Жук(3)";}
else if($bot=='9.9.9'){$name = "Крыса"; $name2 = "Крыса"; $name3 = "Крыса"; $d1 = "Крыса(1)"; $d2 = "Крыса(2)"; $d3 = "Крыса(3)";}
else if($bot=='10.10.10'){$name = "Безголовый"; $name2 = "Безголовый"; $name3 = "Безголовый"; $d1 = "Безголовый(1)"; $d2 = "Безголовый(2)"; $d3 = "Безголовый(3)";}
$mine_id=$db["id"];
$ass = mysql_query("SELECT glav_id,glava FROM labirint WHERE user_id='$mine_id'");
$lab = mysql_fetch_array($ass);
$glav_id = $lab["glav_id"];
$glava = $lab["glava"];
mysql_query("UPDATE labirint SET boi='$nomer',di='0' WHERE user_id='$mine_id'");
$T1 = mysql_query("INSERT INTO canal_bot (glava,boi,bot,nomer) VALUES('$glava','$nomer','$bot','$nomer')");
//////////////////////////////////////////////////////
$sex = mysql_query("SELECT maxhp,id FROM users WHERE login='$name'");
$dded=mysql_fetch_array($sex);
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$d1."','".$dded["id"]."','','".$dded["maxhp"]."');");
$bot = mysql_insert_id();
$teams = array();
$teams[$user['id']][$bot] = array(0,0,time());
$teams[$bot][$user['id']] = array(0,0,time());
$comment = "лабиринт".$_GET['n'];
mysql_query("INSERT INTO `battle`(`id`,`coment`,`teams`,`timeout`,`type`,`status`,`t1`,`t2`,`to1`,`to2`)VALUES(NULL,'{$comment}','".serialize($teams)."','3','1','0','".$user['id']."','".$bot."','".time()."','".time()."')");
$id = mysql_insert_id();
// апдейтим бота
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$bot} LIMIT 1;");
// создаем лог
$rr = "".nick::id($user['id'])->full(1)." и ".nick::id($bot)->full(1)."";
addlog($id,"Часы показывали ".date("Y.m.d H.i").", когда ".$rr." бросили вызов друг другу.
");
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']};");
if($name2!=''){
$sex2 = mysql_query("SELECT maxhp,id FROM users WHERE login='$name2'");
$dded2=mysql_fetch_array($sex2);
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$d2."','".$dded2["id"]."','{$id}','".$dded2["maxhp"]."');");
$bot2 = mysql_insert_id();
$bd2 = mysql_fetch_array(mysql_query ("SELECT * FROM `battle` WHERE `id` = '{$id}' LIMIT 1;"));
$battle2 = unserialize($bd2['teams']);
$battle2[$bot2] = $battle2[$bot];
foreach($battle2[$bot2] as $k2 => $v2) {
$battle2[$k2][$bot2] = array(0,0,time());
}
$t12 = explode(";",$bd2['t1']);
// проставляем кто-где
if (in_array ($user['id'],$t12)) {$ttt2 = 2;} else { $ttt2 = 1;}
$sdds2 = mysql_query("UPDATE `battle` SET `teams` = '".serialize($battle2)."', `t".$ttt2."`=CONCAT(`t".$ttt2."`,';".$bot2."') WHERE `id` = '{$id}'");
mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = '{$id}' LIMIT 1;");
}
if($name3!=''){
$sex3 = mysql_query("SELECT maxhp,id FROM users WHERE login='$name3'");
$dded3=mysql_fetch_array($sex3);
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$d3."','".$dded3["id"]."','{$id}','".$dded3["maxhp"]."');");
$bot3 = mysql_insert_id();
$bd3 = mysql_fetch_array(mysql_query ("SELECT * FROM `battle` WHERE `id` = '{$id}' LIMIT 1;"));
$battle3 = unserialize($bd3['teams']);
$battle3[$bot3] = $battle3[$bot];
foreach($battle3[$bot3] as $k3 => $v3) {
$battle3[$k3][$bot3] = array(0,0,time());
}
$t13 = explode(";",$bd3['t1']);
// проставляем кто-где
if (in_array ($user['id'],$t13)) {$ttt3 = 2;} else { $ttt3 = 1;}
$sdds3 = mysql_query("UPDATE `battle` SET `teams` = '".serialize($battle3)."', `t".$ttt3."`=CONCAT(`t".$ttt3."`,';".$bot3."') WHERE `id` = '{$id}'");
mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = '{$id}' LIMIT 1;");
}
//////////////////////////////////////////////////////
die("");
//////////////////////////////////////////////////////
}
?>