' . (time( ) - 24 * 60 * 60) . ' ORDER BY `time` DESC LIMIT 1' ) ); if (!isset($user) || $user['id'] != $u->info['id']) { echo "No user!"; } elseif ($titm) { echo "Wait asign!"; } else { // не редкий > t1 42% чуть чуть редкий > t2 25% немного редкий > t3 15% редкий > t4 10% очень редкий > t5 5% невероятно редкий > t6 3% /*$droplist = array( 0=>4514, t1 1=>4515, t1 2=>4688, t1 3=>4689, t1 4=>4690, t1 5=>5009, t2 6=>5008, t2 7=>5010, t2 8=>5239, t2 9=>5069, t2 10=>10035, t1 11=>10036, t1 12=>10037, t1 13=>10008, t3 14=>10020, t3 15=>6112, t4 16=>6113, t4 17=>6114, t4 18=>6115, t4 19=>6116, t4 20=>6360, t6 21=>6462, t5 22=>5022, t6 23=>5023, t6 24=>6445, t5 25=>6455, t3 26=>10009, t4 27=>1032, t1 28=>1031, t1 29=>1034 t1 );*/ $nrnd = rand(1, 100); if ($nrnd <= 1) //t6 { $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"'); $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"')); $rndt = rand(0, $y['COUNT'] - 1); $i = 0; while ($pl = mysql_fetch_array($droplistt)) { if ($i == $rndt) { $droplist = $pl; } $i++; } } elseif (($nrnd - 1) <= 5) // t5 { $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"'); $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"')); $rndt = rand(0, $y['COUNT'] - 1); $i = 0; while ($pl = mysql_fetch_array($droplistt)) { if ($i == $rndt) { $droplist = $pl; } $i++; } } elseif (($nrnd - 1 - 5) <= 7) // t4 { $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"'); $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"')); $rndt = rand(0, $y['COUNT'] - 1); $i = 0; while ($pl = mysql_fetch_array($droplistt)) { if ($i == $rndt) { $droplist = $pl; } $i++; } } elseif (($nrnd - 1 - 5 - 7) <= 10) // t3 { $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"'); $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"')); $rndt = rand(0, $y['COUNT'] - 1); $i = 0; while ($pl = mysql_fetch_array($droplistt)) { if ($i == $rndt) { $droplist = $pl; } $i++; } } elseif (($nrnd - 1 - 5 - 7 - 10) <= 15) // t2 { $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"'); $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"')); $rndt = rand(0, $y['COUNT'] - 1); $i = 0; while ($pl = mysql_fetch_array($droplistt)) { if ($i == $rndt) { $droplist = $pl; } $i++; } } else // t1 { $droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"'); $y = mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"')); $rndt = rand(0, $y['COUNT'] - 1); $i = 0; while ($pl = mysql_fetch_array($droplistt)) { if ($i == $rndt) { $droplist = $pl; } $i++; } } if (!isset($droplist['id'])) { echo 'Error'; } else { $idve = $droplist['idgame']; \User\ItemsModel::addItem($idve, $user['id'], '|frompisher=1|nosale=1' . $user['login']); $inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $idve . '" LIMIT 1')); $titm = mysql_query( 'INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $user['id'] . '","' . time( ) . '","' . $user['city'] . '","' . $user['room'] . '","' . $idve . '","' . mysql_real_escape_string( $_SERVER['HTTP_X_REAL_IP'] ) . '","loto")' ); $chat = new Chat(); $chatMessageDto = new ChatMessage(); $chatMessageDto->setText("Игрок {$user['login']} выиграл в бесплатной рулетке {$inf['name']}!"); $chatMessageDto->setType(6); $chat->sendMsg($chatMessageDto); echo $droplist['id']; // } }