Ето вроде нада делать в battle.phpКак сделать так чтоб если с критического удара убиваешь, был шанс поставить травму??
+ сделать травму тем кто проигрывает по таймауту.?
поставил твой код после строчки mysql_query("UPDATE players, participants SET players.hp_now=0 и тд.// ----- # Выиграли по таймауту # ----- //
if (($now-$max['time']>$offer['timeout']) && !$endbattle) {
$echo="<center>Поздравляем! Вы получаете победу по таймауту!
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE players, participants SET players.hp_now=0, players.cure_hp=0, players.last_battle=".$_RESERVER['battle'].", participants.hp=0 WHERE participants.time='".$stat['battle']."' AND participants.side='".$opp_side."' AND players.id=participants.id");
mysql_query("UPDATE offers SET status=0 WHERE time='".$stat['battle']."'");
get_exp();
level_up();
aktivnost();
require_once("inc/chat/functions.php");
insert_msg("Поздравляем, Вы одержали победу! Всего Вами нанесено урона: ".$participant['damage']." HP. Получено опыта: ".$addexp.".","","","1",$stat['user'],"",$stat['room']);
$endbattle = 1;
$stat['battle'] = '';
$stat['cure_hp'] = 0;
// ----- # Конец # ----- //
// ----- # Проиграли по таймауту # ----- //
if (($now-$max['time']>$offer['timeout']) && !$endbattle) {
$echo="<center>[b]Вы проиграли по таймауту.[/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE players, participants SET players.hp_now=0, players.travma=$now+10800, players.last_battle=".$_RESERVER['battle'].", participants.hp=0 WHERE participants.time='".$stat['battle']."' AND participants.side='".$participant['side']."' AND players.id=participants.id");
mysql_query("UPDATE players SET last_battle=".$_RESERVER['battle']." WHERE battle='".$stat['battle']."' AND side='".$opp_side."'");
if ($offer['blood'] == 1) mysql_query("UPDATE players SET travma=$now+10800 WHERE battle='".$stat['battle']."' AND side='".$participant['side']."'");
mysql_query("UPDATE players SET losses=losses+1, battle=NULL WHERE id='".$stat['id']."'");
mysql_query("UPDATE participants SET live=1 WHERE time='".$stat['battle']."' AND id='".$stat['id']."'");
require_once("inc/chat/functions.php");
insert_msg("Вы проиграли по таймауту. Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b].","","","1",$stat['user'],"",$stat['room']);
$endbattle = 1;
$stat['battle'] = '';
} else {
$random=0; // rand(0,$count_opponents-1);
$echo="<form method=POST action=battle.php?page=battle>";
$echo.="<input type=hidden name=opponent value='$victims[$random]'>";
}
// ----- # Выиграли по таймауту # ----- //
if (($now-$max['time']>$offer['timeout']) && !$endbattle) {
$echo="<center>[b]Поздравляем! Вы получаете победу по таймауту![/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE players, participants SET players.hp_now=0, players.last_battle=".$_RESERVER['battle'].", participants.hp=0 WHERE participants.time='".$stat['battle']."' AND participants.side='".$opp_side."' AND players.id=participants.id");
//if ($offer['blood'] == 1) mysql_query("UPDATE players SET travma=$now+10800 WHERE battle='".$stat['battle']."' AND side='".$opp_side."'");
get_exp();
if ($stat['exp']+$addexp >= $level['exp']) {
$new_exp=$stat['exp']+$addexp;
$up_level=mysql_fetch_array(mysql_query("SELECT level FROM levels WHERE exp>".$new_exp." ORDER BY level LIMIT 1"));
$addons=mysql_fetch_array(mysql_query("SELECT SUM(credits) as credits, SUM(updates) as updates FROM levels WHERE level>".$stat['level']." AND level<=".$up_level['level']."-1"));
mysql_query("update players set wins=wins+1, battle=NULL, exp=exp+".$addexp.", s_updates=s_updates+".$addons['updates'].", credits=credits+".$addons['credits'].", level=".$up_level['level']."-1 WHERE id='".$stat['id']."'");
mysql_query("UPDATE participants SET live=1 WHERE time='".$stat['battle']."' AND id='".$stat['id']."'");
}
else {
mysql_query("UPDATE players SET wins=wins+1, battle=NULL, exp=exp+'".$addexp."' where id='".$stat['id']."'");
mysql_query("UPDATE participants SET live=1 WHERE time='".$stat['battle']."' AND id='".$stat['id']."'");
}
if ($stat['vitality']*5 != $stat[ustal_now]) {
mysql_query("UPDATE players SET ustal_now=ustal_now+10 WHERE id='".$stat['id']."'");
}
if ($stat['vitality']*5 < $stat[ustal_now]) {
mysql_query("UPDATE players SET ustal_now='".$stat['vitality']."'*5 WHERE id='".$stat['id']."'");
}
mysql_query("update players set cast=0 where id='".$stat['id']."'");
require_once("inc/chat/functions.php");
insert_msg("Поздравляем, Вы одержали победу! Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b]. Получено опыта: [b][u]".$addexp."[/u][/b].","","","1",$stat['user'],"",$stat['room']);
$endbattle = 1;
$stat['battle'] = '';
// ----- # Конец # ----- //
Блин, как же травмы подкрутить, а то профа лекаря бессмыслена на данный момент
Нашел в Aoth но хз подойдет ли оно к ИВ моей.// ----- # Пройгрыш по таймауту # ----- //
if ($timeout<=0 && $max_['time']!=''){
$opp_stats=mysql_query("SELECT id, user, rank FROM players WHERE user='".addslashes($victims[$random])."' LIMIT 1");
$opp_stat=mysql_fetch_array($opp_stats);
include("inc/battle/changed_opp.php");
//if ($opp_stat['rank'] == 60){
$echo="<center>Бой закончен. Вы проиграли по таймауту и получили травму!
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
<script LANGUAGE='JavaScript'>top.frames['buttons'].rez=3;</SCRIPT>";
//echo mysql_error();
mysql_query("UPDATE players SET losses=losses+1, battle=NULL, hp_now=0, travma=$now+3600 WHERE id='".$stat['id']."'");
if ($opp_stat['rank'] == 60)
mysql_query("UPDATE players SET wins=wins+1, battle=NULL, hp_now=".$opp_hp_max." WHERE id='".$opp_stat['id']."'");
mysql_query("UPDATE participants SET live=1 WHERE time='".$stat['battle']."' AND id='".$stat['id']."'");
require_once("inc/chat/functions.php");
insert_msg ("Бой закончен, Вы проиграли по таймауту и получили травму! Всего Вами нанесено урона: ".$participant['damage']." HP.","","","1",$stat['user'],"",$stat['room']);
// insert_msg (mysql_error(),"","","1",$stat['user'],"",$stat['room']);
$masseg = iznos();
if ($masseg) insert_msg ($masseg,"","","1",$stat['user'],"",$stat['room']);
if ($offer['blood'] == 1) mysql_query("UPDATE players SET travma=$now+3600 WHERE id='".$stat['id']."'");
$endbattle = 1;
$stat['battle'] = '';
//}
}
// ----- # Конец # ----- //