From 168103042aeaa5954019c5a373b083f2968c16fe Mon Sep 17 00:00:00 2001 From: "Igor Barkov [iwork]" Date: Thu, 13 Dec 2018 18:36:30 +0200 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D0=B9=D0=BD=D0=B0=20=D1=81=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B7=D0=B0=D1=8F=D0=B2=D0=BE=D0=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cronjobs/cron.php | 52 ++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/cronjobs/cron.php b/cronjobs/cron.php index 9a3d731..6b1c085 100644 --- a/cronjobs/cron.php +++ b/cronjobs/cron.php @@ -21,30 +21,6 @@ while ($zayavka) { } } -function delzayavka($id, $zay, $r, $f = 1) -{ - $z = getlist($r, null, $zay); - if ($f != 1) { - if ($z[$zay]['level'] > 3) { - return 'Ай-ай-ай!'; - } - } - - if (mysql_query("DELETE FROM `zayavka` WHERE `id` = {$zay} AND (`team1` LIKE '{$id};%' OR `team2` LIKE '{$id};%') LIMIT 1")) { - if (count($z[$zay]['team1']) > 0) { - foreach ($z[$zay]['team1'] as $k => $v) { - mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `id` = {$v}"); - } - } - - if (count($z[$zay]['team2']) > 0) { - foreach ($z[$zay]['team2'] as $k => $v) { - mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `id` = {$v}"); - } - } - } -} - function fteam($team) { $team = explode(";", $team); @@ -73,6 +49,23 @@ function getlist($razdel = 1, $level = null, $id = null) return $zayavka; } +function delzayavka($id, $zay, $r) +{ + $z = getlist($r, null, $zay); + if ($z[$zay]['level'] > 3) return 'Ай-ай-ай!'; + + if (db::c()->query('DELETE FROM `zayavka` WHERE `id` = ?i AND (`team1` LIKE "?S" OR `team2` LIKE "?S")', $zay, $id.';%', $id.';%')) { + if (count($z[$zay]['team1']) > 0) + foreach ($z[$zay]['team1'] as $k => $v) + db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v); + + if (count($z[$zay]['team2']) > 0) + foreach ($z[$zay]['team2'] as $k => $v) + db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v); + } + return true; +} + function startbattle($id, $zay, $r) { $z = getlist($r, null, $zay); @@ -83,7 +76,6 @@ function startbattle($id, $zay, $r) $z = $z[$zay]; $count_users = count($z['team1']); - $bot = 0; if ($z['bots'] > 0 && $count_users > 0) { $bots_raw = [7 => [10962, 10964, 10965], 8 => [10962, 10964, 10965], 13 => [10962, 10964, 10965]]; $i = 0; @@ -96,16 +88,6 @@ function startbattle($id, $zay, $r) } } - if ($z['type'] == 4 || $z['type'] == 5) { - foreach ($z['team1'] as $k => $v) { - undressall($v); - } - - foreach ($z['team2'] as $k => $v) { - undressall($v); - } - } - // Групповой/хаотический бой накрылся потому что меньше 4 человек. if ($z['type'] == 3 || $z['type'] == 5) { if ($count_users < 4) {