2022-06-06 21:30:34 +00:00
|
|
|
<?php
|
|
|
|
|
2022-08-25 11:23:36 +00:00
|
|
|
const GAME = true;
|
2022-06-06 21:30:34 +00:00
|
|
|
include('_incl_data/__config.php');
|
|
|
|
include('_incl_data/class/__db_connect.php');
|
2022-08-25 11:23:36 +00:00
|
|
|
$u = User::start();
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
$body = file_get_contents('php://input');
|
2022-08-25 11:23:36 +00:00
|
|
|
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $body . '" LIMIT 1'));
|
|
|
|
if ($body == 'ekr') {
|
|
|
|
echo $u->info['money2'];
|
|
|
|
die();
|
2022-06-06 21:30:34 +00:00
|
|
|
}
|
|
|
|
|
2022-08-25 11:23:36 +00:00
|
|
|
if (!isset($user) || $user['id'] != $u->info['id']) {
|
|
|
|
echo "No user!";
|
|
|
|
} else {
|
|
|
|
if ($user['money2'] < 5) {
|
|
|
|
echo "No Ekr!";
|
|
|
|
} else {
|
|
|
|
$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"'));
|
|
|
|
} elseif (($nrnd - 1) <= 7) // 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"'));
|
|
|
|
} elseif (($nrnd - 1 - 7) <= 10) // 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"'));
|
|
|
|
} elseif (($nrnd - 1 - 7 - 10) <= 15) // 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"'));
|
|
|
|
} elseif (($nrnd - 1 - 7 - 10 - 15) <= 25) // 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"'));
|
|
|
|
} 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"'));
|
2023-01-28 02:24:37 +00:00
|
|
|
}
|
|
|
|
$rndt = rand(0, $y['COUNT'] - 1);
|
|
|
|
$i = 0;
|
|
|
|
while ($pl = mysql_fetch_array($droplistt)) {
|
|
|
|
if ($i == $rndt) {
|
|
|
|
$droplist = $pl;
|
2022-08-25 11:23:36 +00:00
|
|
|
}
|
2023-01-28 02:24:37 +00:00
|
|
|
$i++;
|
2022-08-25 11:23:36 +00:00
|
|
|
}
|
|
|
|
if (!isset($droplist['id'])) {
|
|
|
|
echo 'Error';
|
|
|
|
} else {
|
|
|
|
$idve = $droplist['idgame'];
|
|
|
|
$u->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'));
|
|
|
|
$u->info['money2'] = $u->info['money2'] - 5;
|
|
|
|
mysql_query('UPDATE `users` SET `money2`= `money2` - 5 WHERE `id` = "' . $u->info['id'] . '"');
|
|
|
|
if ($droplist['type'] == "t6" || $droplist['type'] == "t5") {
|
2023-01-28 02:24:37 +00:00
|
|
|
$cmsg = new ChatMessage();
|
|
|
|
$cmsg->setText("Игрок {$user['login']} выиграл в платной рулетке <b>{$inf['name']}</b>!");
|
|
|
|
$cmsg->setType(6);
|
|
|
|
(new Chat())->sendMsg($cmsg);
|
2022-08-25 11:23:36 +00:00
|
|
|
}
|
2023-01-10 16:29:32 +00:00
|
|
|
echo $droplist['id']; // это закоментить
|
|
|
|
/*//этот блок разкоментить
|
2022-08-25 11:23:36 +00:00
|
|
|
$array = array(
|
2023-01-10 16:29:32 +00:00
|
|
|
'1' => $droplist['id']', // 1 элемент id вещи
|
|
|
|
'2' => $u->info['money2'] // бабло пользователя
|
2022-08-25 11:23:36 +00:00
|
|
|
);
|
|
|
|
$json = json_encode($array);
|
|
|
|
echo $json;*/
|
|
|
|
}
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
}
|