Обучение/Помощь новичкам | Битва титанов лаг
vitekya3 , код игры в студию.
Radeon , <?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Дуэли';
include './system/h.php';
if(mysql_result(mysql_query('SELECT * FROM `duel` WHERE `user` = "'.$user['id'].'"'),0) == 0) {
mysql_query('INSERT INTO `duel` (`user`) VALUES ("'.$user['id'].'")');
}
$duel = mysql_query('SELECT * FROM `duel` WHERE `user` = "'.$user['id'].'"');
$duel = mysql_fetch_array($duel);
if($_GET['refresh'] == true) {
if($user['duel_fights'] > 0 OR $user['g'] < 20) {
header('location: /duel/');
exit;
}
mysql_query('UPDATE `users` SET `duel_fights` = "10",
`g` = `g` - 20 WHERE `id` = "'.$user['id'].'"');
header('location: /duel/');
}
?>
<div class='title'><?=$title?></div>
<?
if($user['level'] > 4) {
if($_GET['last'] == true && $user['duel_changes'] > 0) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` >= "'.($user['duel_rating']/2).'" AND `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
if(!$opponent) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
}
mysql_query('UPDATE `users` SET `duel_changes` = `duel_changes` - 1 WHERE `id` = "'.$user['id'].'"');
mysql_query('UPDATE `duel` SET `opponent` = "'.$opponent['id'].'" WHERE `user` = "'.$user['id'].'"');
header('location: /duel/');
}
if(!$duel['opponent']) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` >= "'.($user['duel_rating']/2).'" AND `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
if(!$opponent) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
}
mysql_query('UPDATE `duel` SET `opponent` = "'.$opponent['id'].'" WHERE `user` = "'.$user['id'].'"');
}
else
{
$opponent = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$duel['opponent'].'"');
$opponent = mysql_fetch_array($opponent);
}
if($_GET['attack'] == true) {
if(time() - $duel['time'] < 1) {
header('location: /duel/');
exit;
}
if($user['hp'] > ( ( ($user['vit'] * 2) / 100 ) * 10 )) {
if( $user['duel_fights'] > 0) {
$dmg = 0;
$opponent_dmg = 0;
for($round = 1; $round < 6; $round++) {
if($user['ability_1'] > 0) {
switch($user['ability_1']) {
case 0:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 1:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 2:
$a_1_bonus = 30;
$a_1_chanse = 5;
break;
case 3:
$a_1_bonus = 35;
$a_1_chanse = 5;
break;
case 4:
$a_1_bonus = 40;
$a_1_chanse = 5;
break;
case 5:
$a_1_bonus = 45;
$a_1_chanse = 5;
break;
case 6:
$a_1_bonus = 45;
$a_1_chanse = 8;
break;
case 7:
$a_1_bonus = 50;
$a_1_chanse = 8;
break;
case 8:
$a_1_bonus = 55;
$a_1_chanse = 8;
break;
case 9:
$a_1_bonus = 60;
$a_1_chanse = 8;
break;
case 10:
$a_1_bonus = 65;
$a_1_chanse = 8;
break;
case 11:
$a_1_bonus = 65;
$a_1_chanse = 11;
break;
case 12:
$a_1_bonus = 70;
$a_1_chanse = 11;
break;
case 13:
$a_1_bonus = 75;
$a_1_chanse = 11;
break;
case 14:
$a_1_bonus = 80;
$a_1_chanse = 11;
break;
case 15:
$a_1_bonus = 85;
$a_1_chanse = 11;
break;
case 16:
$a_1_bonus = 85;
$a_1_chanse = 14;
break;
case 17:
$a_1_bonus = 90;
$a_1_chanse = 14;
break;
case 18:
$a_1_bonus = 95;
$a_1_chanse = 14;
break;
case 19:
$a_1_bonus = 100;
$a_1_chanse = 14;
break;
case 20:
$a_1_bonus = 105;
$a_1_chanse = 14;
break;
case 21:
$a_1_bonus = 105;
$a_1_chanse = 17;
break;
case 22:
$a_1_bonus = 145;
$a_1_chanse = 20;
break;
case 23:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
case 24:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
}
if(mt_rand(0, 100) <= $a_1_chanse) {
$a_1 = true;
}
}
if($user['ability_2'] > 0) {
switch($user['ability_2']) {
case 0:
$a_2_bonus = 25;
$a_2_chanse = 5;
break;
case 1:
$a_2_bonus = 25;
$a_2_chanse = 5;
break;
case 2:
$a_2_bonus = 30;
$a_2_chanse = 5;
break;
case 3:
$a_2_bonus = 35;
$a_2_chanse = 5;
break;
case 4:
$a_2_bonus = 40;
$a_2_chanse = 5;
break;
case 5:
$a_2_bonus = 45;
$a_2_chanse = 5;
break;
case 6:
$a_2_bonus = 45;
$a_2_chanse = 8;
break;
case 7:
$a_2_bonus = 50;
$a_2_chanse = 8;
break;
case 8:
$a_2_bonus = 55;
$a_2_chanse = 8;
break;
ca
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Дуэли';
include './system/h.php';
if(mysql_result(mysql_query('SELECT * FROM `duel` WHERE `user` = "'.$user['id'].'"'),0) == 0) {
mysql_query('INSERT INTO `duel` (`user`) VALUES ("'.$user['id'].'")');
}
$duel = mysql_query('SELECT * FROM `duel` WHERE `user` = "'.$user['id'].'"');
$duel = mysql_fetch_array($duel);
if($_GET['refresh'] == true) {
if($user['duel_fights'] > 0 OR $user['g'] < 20) {
header('location: /duel/');
exit;
}
mysql_query('UPDATE `users` SET `duel_fights` = "10",
`g` = `g` - 20 WHERE `id` = "'.$user['id'].'"');
header('location: /duel/');
}
?>
<div class='title'><?=$title?></div>
<?
if($user['level'] > 4) {
if($_GET['last'] == true && $user['duel_changes'] > 0) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` >= "'.($user['duel_rating']/2).'" AND `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
if(!$opponent) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
}
mysql_query('UPDATE `users` SET `duel_changes` = `duel_changes` - 1 WHERE `id` = "'.$user['id'].'"');
mysql_query('UPDATE `duel` SET `opponent` = "'.$opponent['id'].'" WHERE `user` = "'.$user['id'].'"');
header('location: /duel/');
}
if(!$duel['opponent']) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` >= "'.($user['duel_rating']/2).'" AND `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
if(!$opponent) {
$opponent = mysql_query('SELECT * FROM `users` WHERE `duel_rating` <= "'.$user['duel_rating'].'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$opponent = mysql_fetch_array($opponent);
}
mysql_query('UPDATE `duel` SET `opponent` = "'.$opponent['id'].'" WHERE `user` = "'.$user['id'].'"');
}
else
{
$opponent = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$duel['opponent'].'"');
$opponent = mysql_fetch_array($opponent);
}
if($_GET['attack'] == true) {
if(time() - $duel['time'] < 1) {
header('location: /duel/');
exit;
}
if($user['hp'] > ( ( ($user['vit'] * 2) / 100 ) * 10 )) {
if( $user['duel_fights'] > 0) {
$dmg = 0;
$opponent_dmg = 0;
for($round = 1; $round < 6; $round++) {
if($user['ability_1'] > 0) {
switch($user['ability_1']) {
case 0:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 1:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 2:
$a_1_bonus = 30;
$a_1_chanse = 5;
break;
case 3:
$a_1_bonus = 35;
$a_1_chanse = 5;
break;
case 4:
$a_1_bonus = 40;
$a_1_chanse = 5;
break;
case 5:
$a_1_bonus = 45;
$a_1_chanse = 5;
break;
case 6:
$a_1_bonus = 45;
$a_1_chanse = 8;
break;
case 7:
$a_1_bonus = 50;
$a_1_chanse = 8;
break;
case 8:
$a_1_bonus = 55;
$a_1_chanse = 8;
break;
case 9:
$a_1_bonus = 60;
$a_1_chanse = 8;
break;
case 10:
$a_1_bonus = 65;
$a_1_chanse = 8;
break;
case 11:
$a_1_bonus = 65;
$a_1_chanse = 11;
break;
case 12:
$a_1_bonus = 70;
$a_1_chanse = 11;
break;
case 13:
$a_1_bonus = 75;
$a_1_chanse = 11;
break;
case 14:
$a_1_bonus = 80;
$a_1_chanse = 11;
break;
case 15:
$a_1_bonus = 85;
$a_1_chanse = 11;
break;
case 16:
$a_1_bonus = 85;
$a_1_chanse = 14;
break;
case 17:
$a_1_bonus = 90;
$a_1_chanse = 14;
break;
case 18:
$a_1_bonus = 95;
$a_1_chanse = 14;
break;
case 19:
$a_1_bonus = 100;
$a_1_chanse = 14;
break;
case 20:
$a_1_bonus = 105;
$a_1_chanse = 14;
break;
case 21:
$a_1_bonus = 105;
$a_1_chanse = 17;
break;
case 22:
$a_1_bonus = 145;
$a_1_chanse = 20;
break;
case 23:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
case 24:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
}
if(mt_rand(0, 100) <= $a_1_chanse) {
$a_1 = true;
}
}
if($user['ability_2'] > 0) {
switch($user['ability_2']) {
case 0:
$a_2_bonus = 25;
$a_2_chanse = 5;
break;
case 1:
$a_2_bonus = 25;
$a_2_chanse = 5;
break;
case 2:
$a_2_bonus = 30;
$a_2_chanse = 5;
break;
case 3:
$a_2_bonus = 35;
$a_2_chanse = 5;
break;
case 4:
$a_2_bonus = 40;
$a_2_chanse = 5;
break;
case 5:
$a_2_bonus = 45;
$a_2_chanse = 5;
break;
case 6:
$a_2_bonus = 45;
$a_2_chanse = 8;
break;
case 7:
$a_2_bonus = 50;
$a_2_chanse = 8;
break;
case 8:
$a_2_bonus = 55;
$a_2_chanse = 8;
break;
ca
весь код кидай балван
________
посл. ред. 22.12.2016 в 21:03; всего 1 раз(а); by Коляда
________
посл. ред. 22.12.2016 в 21:03; всего 1 раз(а); by Коляда
DELETED
22 декабря 2016, в 21:53
Delete
vitekya3 , пишешь ссылку дать не можешь,а на скрине ее типа не видно?=)
vitekya3 , твои непонятные кракозябры, даже и смотреть не кто не будет
хотя бы используй http://pastebin.com/
с подсветкой синтаксиса
хотя бы используй http://pastebin.com/
с подсветкой синтаксиса
Стр.: 1, 2