Помощь по скриптам | Помогите
Проблема такова.
Когда захожу в бой выбрасывает и пишет вы сбежали.
<?php
require_once ('system/func.php');
$title = 'Сражение ';
require_once ('system/header.php');
auth(); // Закроем от гостей
$fights=mysql_fetch_assoc(mysql_query("SELECT * FROM `fights` WHERE `id_user`='".$myID."' LIMIT 1"));
$ability = mysql_query("SELECT * FROM `ability` WHERE `id_user` = '".$myID."' ORDER BY `id` LIMIT 1");
$ability = mysql_fetch_array($ability);
if($fights['health'] > $user['max_health'] + $ClassHp) $fights['health'] = $user['max_health'] + $ClassHp;
//Если игрок не был еще на сражениях
if(!$fights)
{
mysql_query("INSERT INTO `fights` SET `id_user`='".$myID."'");
mysql_query("UPDATE `fights` SET `health`='$hp' WHERE `id_user`='".$myID."' LIMIT 1");
}
//Регистрация мобов
$mob = mysql_query("SELECT * FROM `fights_mob` WHERE `lvl` <= '$user[level]' ORDER BY RAND()");
$mob = mysql_fetch_assoc($mob);
//Если игрок убежа во время боя
if($fights['exit'] > time()){
echo div('header ')." <img src='/images/fight/logo.jpg'></div>";
$hp = $user['max_health'];
mysql_query("update `ability` set `energy` = '0' , `statusHp` = '0' , `statusDef` = '0' , `statusStr` = '0' where (`id_user` = '".$myID."')");
mysql_query("UPDATE `fights` SET `health`='$hp' , `status` = '0' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("DELETE FROM `fights_log` WHERE `id_user`='".$myID."'");
echo div('header')." Вы убежали во время боя<br> Вернуться в бой через: ".tl($fights['exit'] -time())." <br><div class='cbtn blue center mt3'><span class='cb_end'><span class='cb_ttl'><a href='?'>Обновить </div></span></span></a></div>";
require_once ('system/footer.php');
break;
}
if($fights['resp'] > time()){
echo div('header')." <img src='/images/fight/logo.jpg'></div>";
echo div('header')." Вы отступили<br> Вернуться в бой через: ".tl($fights['resp'] -time())."<br> <div class='cbtn blue center mt3'><span class='cb_end'><span class='cb_ttl'><a href='?'>Обновить </div></span></span></a></div>";
$hp = $user['max_health'];
mysql_query("DELETE FROM `fights_log` WHERE `id_user`='".$myID."'");
mysql_query("UPDATE `fights` SET `health`='$hp' , `status` = '0' WHERE `id_user`='".$myID."' LIMIT 1");
require_once ('system/footer.php');
break;
}
if(isset($_GET['start'])){
mysql_query("UPDATE `fights` SET `status` = '2' WHERE `id_user`='".$myID."'");
$hp = $user['max_health'];
mysql_query("UPDATE `fights` SET `health`='$hp'WHERE `id_user`='".$myID."' LIMIT 1");
header('Location: /fights/battle/');
exit();
}
if($fights['heatlh'] > $user['max_health']) $fights['health'] = $user['max_health'];
switch(isset($_GET['action'])){
case 'battle':
if($fights['status'] != 2){
header('Location: /fights/');
exit();
}
//Если у игрока мало жизней
if($fights['health'] <= 0){
mysql_query("update `ability` set `energy` = '0' , `statusHp` = '0' , `statusDef` = '0' , `statusStr` = '0' where (`id_user` = '".$myID."')");
mysql_query("UPDATE `fights` SET `resp`='".(time()+300)."' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("UPDATE `fights` SET `opp_name`= '$mob[name]' , `opp_health`='$mob[health]' , `opp_max_health`='$mob[health]' , `str`= '$mob[str]' , `def`='$mob[def]' WHERE `id_user`='".$myID."' LIMIT 1");
header('Location: /fights/');
exit();
}
if(isset($_GET['change']) and $fights['last'] < time()){
mysql_query("UPDATE `fights` SET `opp_name`= '0' , `opp_health`='0' , `opp_max_health`='0' , `str`= '0' , `def`='0' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("UPDATE `fights` SET `last`='".(time()+ 60)."' WHERE `id_user`='".$myID."' LIMIT 1");
$log = 'Вы убежали ';
mysql_query("INSERT INTO `fights_log` SET `id_user`='".$myID."', `text`='".$log."'");
header('Location: /fights/battle/');
exit();
}
if(isset($_GET['next'] ) ){
mysql_query("UPDATE `fights` SET `opp_name`= '0' , `opp_health`='0' , `opp_max_health`='0' , `str`= '0' , `def`='0' , `status`='0' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("UPDATE `fights` SET `exit`='".(time()+ 900)."' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("DELETE FROM `fights_log` WHERE `id_user`='".$myID."'");
$_SESSION[''] = 'Вы покинули Сражение ';
header('Location: /main');
exit();
}
if(isset($_GET['next'])){
mysql_query("UPDATE `fights` SET `status` = '2' WHERE `id_user`='".$myID."'");
$r = rand(1,5);
switch ($r){
case 1:
mysql_query("UPDATE `fights` SET `opp_name`= '$mob[name]' , `opp_health`='$mob[health]' , `opp_max_health`='$mob[health]' , `str`= '$mob[str]' , `def`='$mob[def]' WHERE `id_user`='".$myID."' LIMIT 1");
$log = 'На вас напал '.$mob['name'].'';
mysql_query("INSERT INTO `fights_log` SET `id_user`='".$myID."', `text`='&quo
Когда захожу в бой выбрасывает и пишет вы сбежали.
<?php
require_once ('system/func.php');
$title = 'Сражение ';
require_once ('system/header.php');
auth(); // Закроем от гостей
$fights=mysql_fetch_assoc(mysql_query("SELECT * FROM `fights` WHERE `id_user`='".$myID."' LIMIT 1"));
$ability = mysql_query("SELECT * FROM `ability` WHERE `id_user` = '".$myID."' ORDER BY `id` LIMIT 1");
$ability = mysql_fetch_array($ability);
if($fights['health'] > $user['max_health'] + $ClassHp) $fights['health'] = $user['max_health'] + $ClassHp;
//Если игрок не был еще на сражениях
if(!$fights)
{
mysql_query("INSERT INTO `fights` SET `id_user`='".$myID."'");
mysql_query("UPDATE `fights` SET `health`='$hp' WHERE `id_user`='".$myID."' LIMIT 1");
}
//Регистрация мобов
$mob = mysql_query("SELECT * FROM `fights_mob` WHERE `lvl` <= '$user[level]' ORDER BY RAND()");
$mob = mysql_fetch_assoc($mob);
//Если игрок убежа во время боя
if($fights['exit'] > time()){
echo div('header ')." <img src='/images/fight/logo.jpg'></div>";
$hp = $user['max_health'];
mysql_query("update `ability` set `energy` = '0' , `statusHp` = '0' , `statusDef` = '0' , `statusStr` = '0' where (`id_user` = '".$myID."')");
mysql_query("UPDATE `fights` SET `health`='$hp' , `status` = '0' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("DELETE FROM `fights_log` WHERE `id_user`='".$myID."'");
echo div('header')." Вы убежали во время боя<br> Вернуться в бой через: ".tl($fights['exit'] -time())." <br><div class='cbtn blue center mt3'><span class='cb_end'><span class='cb_ttl'><a href='?'>Обновить </div></span></span></a></div>";
require_once ('system/footer.php');
break;
}
if($fights['resp'] > time()){
echo div('header')." <img src='/images/fight/logo.jpg'></div>";
echo div('header')." Вы отступили<br> Вернуться в бой через: ".tl($fights['resp'] -time())."<br> <div class='cbtn blue center mt3'><span class='cb_end'><span class='cb_ttl'><a href='?'>Обновить </div></span></span></a></div>";
$hp = $user['max_health'];
mysql_query("DELETE FROM `fights_log` WHERE `id_user`='".$myID."'");
mysql_query("UPDATE `fights` SET `health`='$hp' , `status` = '0' WHERE `id_user`='".$myID."' LIMIT 1");
require_once ('system/footer.php');
break;
}
if(isset($_GET['start'])){
mysql_query("UPDATE `fights` SET `status` = '2' WHERE `id_user`='".$myID."'");
$hp = $user['max_health'];
mysql_query("UPDATE `fights` SET `health`='$hp'WHERE `id_user`='".$myID."' LIMIT 1");
header('Location: /fights/battle/');
exit();
}
if($fights['heatlh'] > $user['max_health']) $fights['health'] = $user['max_health'];
switch(isset($_GET['action'])){
case 'battle':
if($fights['status'] != 2){
header('Location: /fights/');
exit();
}
//Если у игрока мало жизней
if($fights['health'] <= 0){
mysql_query("update `ability` set `energy` = '0' , `statusHp` = '0' , `statusDef` = '0' , `statusStr` = '0' where (`id_user` = '".$myID."')");
mysql_query("UPDATE `fights` SET `resp`='".(time()+300)."' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("UPDATE `fights` SET `opp_name`= '$mob[name]' , `opp_health`='$mob[health]' , `opp_max_health`='$mob[health]' , `str`= '$mob[str]' , `def`='$mob[def]' WHERE `id_user`='".$myID."' LIMIT 1");
header('Location: /fights/');
exit();
}
if(isset($_GET['change']) and $fights['last'] < time()){
mysql_query("UPDATE `fights` SET `opp_name`= '0' , `opp_health`='0' , `opp_max_health`='0' , `str`= '0' , `def`='0' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("UPDATE `fights` SET `last`='".(time()+ 60)."' WHERE `id_user`='".$myID."' LIMIT 1");
$log = 'Вы убежали ';
mysql_query("INSERT INTO `fights_log` SET `id_user`='".$myID."', `text`='".$log."'");
header('Location: /fights/battle/');
exit();
}
if(isset($_GET['next'] ) ){
mysql_query("UPDATE `fights` SET `opp_name`= '0' , `opp_health`='0' , `opp_max_health`='0' , `str`= '0' , `def`='0' , `status`='0' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("UPDATE `fights` SET `exit`='".(time()+ 900)."' WHERE `id_user`='".$myID."' LIMIT 1");
mysql_query("DELETE FROM `fights_log` WHERE `id_user`='".$myID."'");
$_SESSION[''] = 'Вы покинули Сражение ';
header('Location: /main');
exit();
}
if(isset($_GET['next'])){
mysql_query("UPDATE `fights` SET `status` = '2' WHERE `id_user`='".$myID."'");
$r = rand(1,5);
switch ($r){
case 1:
mysql_query("UPDATE `fights` SET `opp_name`= '$mob[name]' , `opp_health`='$mob[health]' , `opp_max_health`='$mob[health]' , `str`= '$mob[str]' , `def`='$mob[def]' WHERE `id_user`='".$myID."' LIMIT 1");
$log = 'На вас напал '.$mob['name'].'';
mysql_query("INSERT INTO `fights_log` SET `id_user`='".$myID."', `text`='&quo
$fights['exit'] изначально больше time()
из-за этого и показывает, что убежал
из-за этого и показывает, что убежал
361335288 , Это не здесь это прописано
361335288 , Это у другом файле
Mr_Grey , каком
361335288 , Это специально я когда писал вроде у шапку игры поставил
Это двиг Лег.эпоха?
Это двиг Лег.эпоха?
Да