Как рандомизировать событие?

5fdf30d877871743271520.png
5fdf30e0c322e747200485.png

Надо рандомизировать появление "ботов", как это сделать? Именно имена ботов, а не их выбранные числа или Выигрыш/Проигрыш

<?php
require("inc/bd.php");
$bots_active = 1;
session_start();
$sid = $_SESSION['hash'];
$allbots = "SELECT COUNT(*) FROM kot_bots";
$result_bots = mysql_query($allbots);
$row = mysql_fetch_array($result_bots);
if($row)
{	
$bots = $row['COUNT(*)'];
}
if($bots_active == 1) {
if($bots >= 1) {
$randbot = rand(1, $bots); // выбор бота

$select_info_bot = "SELECT * FROM kot_bots WHERE id = '$randbot'";
$result_select_bots = mysql_query($select_info_bot);
$row = mysql_fetch_array($result_select_bots);
if($row)
{
$active = $row['status'];
$logbot = $row['bot_login'];
$bot_min = $row['bot_min_bet'];
$bot_max = $row['bot_max_bet'];
}
if($active == 1) {
$rand_bot_bet = rand($bot_min, $bot_max); // ставка бота
$rand_bot_per = rand(1, 95); // шанс на выигрыш бота
$rand_bot_number = rand(0, 999999);
$rand_bot_sum = round(((100 / $rand_bot_per) * $rand_bot_bet), 2);
$rand_bot_type = array('min', 'max'); // м или б
$rand_bot_type_select = rand(0, 1);
if($rand_bot_type_select == 0) {
$rand_bot_win_num = $rand_bot_per * 10000;
if($rand_bot_number > $rand_bot_win_num) {
  $rand_bot_type_game = "lose"; // бот проиграл
  $rand_bot_sum = 0;
  $rand_bot_cel = "0 - $rand_bot_win_num";
  $bot = "INSERT INTO `kot_games` (`id`, `user_id`, `login`, `number`, `cel`, `sum`, `chance`, `type`, `win_summa`) VALUES (NULL, '1', '$logbot', '$rand_bot_number', '$rand_bot_cel', '$rand_bot_bet', '$rand_bot_per', '$rand_bot_type_game', '$rand_bot_sum');";
  mysql_query($bot);
  }
  if($rand_bot_number < $rand_bot_win_num) { // если бот выиграл
  $rand_bot_type_game = "win"; // бот выиграл
  $rand_bot_sum = round(((100 / $rand_bot_per) * $rand_bot_bet), 2);
  $rand_bot_cel = "0 - $rand_bot_win_num";
  $bot = "INSERT INTO `kot_games` (`id`, `user_id`, `login`, `number`, `cel`, `sum`, `chance`, `type`, `win_summa`) VALUES (NULL, '1', '$logbot', '$rand_bot_number', '$rand_bot_cel', '$rand_bot_bet', '$rand_bot_per', '$rand_bot_type_game', '$rand_bot_sum');";
  mysql_query($bot);
  }
}
 // если бот ставит на больше 
if($rand_bot_type_select == 1) {
$rand_bot_win_num = 1000000 - ($rand_bot_per * 10000);
if($rand_bot_number < $rand_bot_win_num) {
  $rand_bot_type_game = "lose"; // бот проиграл
  $rand_bot_sum = 0;
  $rand_bot_cel = "$rand_bot_win_num - 999999";
  $bot = "INSERT INTO `kot_games` (`id`, `user_id`, `login`, `number`, `cel`, `sum`, `chance`, `type`, `win_summa`) VALUES (NULL, '1', '$logbot', '$rand_bot_number', '$rand_bot_cel', '$rand_bot_bet', '$rand_bot_per', '$rand_bot_type_game', '$rand_bot_sum');";
  mysql_query($bot);
  }
  if($rand_bot_number > $rand_bot_win_num) { // бот выиграл
  $rand_bot_type_game = "win"; // бот выиграл
  $rand_bot_sum = round(((100 / $rand_bot_per) * $rand_bot_bet), 2);
  $rand_bot_cel = "$rand_bot_win_num - 999999";
  $bot = "INSERT INTO `kot_games` (`id`, `user_id`, `login`, `number`, `cel`, `sum`, `chance`, `type`, `win_summa`) VALUES (NULL, '1', '$logbot', '$rand_bot_number', '$rand_bot_cel', '$rand_bot_bet', '$rand_bot_per', '$rand_bot_type_game', '$rand_bot_sum');";
  mysql_query($bot);
  }
}
}
}
}
?>
  • Вопрос задан
  • 55 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
YCLIENTS Москва
от 200 000 до 350 000 ₽
Ведисофт Екатеринбург
от 25 000 ₽
ИТЦ Аусферр Магнитогорск
от 100 000 до 160 000 ₽