Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- include_once 'vk.php';
- include_once 'config.php';
- include_once 'exdbase.php';
- $prizes = [
- 1 => [
- 'money' => 100000000,
- 'pcase' => 15,
- ],
- 2 => [
- 'money' => 75000000,
- 'pcase' => 10,
- ],
- 3 => [
- 'money' => 75000000,
- 'pcase' => 8,
- ],
- 4 => [
- 'money' => 50000000,
- 'pcase' => 5,
- ],
- 5 => [
- 'money' => 50000000,
- 'pcase' => 5,
- ],
- 6 => [
- 'money' => 50000000,
- 'pcase' => 5,
- 'randomcar' => true
- ],
- 7 => [
- 'money' => 30000000,
- 'pcase' => 5,
- 'profilechange' => 5,
- 'randomcar' => true
- ],
- 8 => [
- 'money' => 30000000,
- 'pcase' => 3,
- 'profilechange' => 3,
- 'randomcar' => true
- ],
- 9 => [
- 'money' => 30000000,
- 'pcase' => 3,
- 'profilechange' => 1,
- 'randomcar' => true
- ],
- 10 => [
- 'profilechange' => 2147483648
- ],
- 11 => [
- 'money' => 25000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 12 => [
- 'money' => 25000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 13 => [
- 'money' => 25000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 14 => [
- 'money' => 25000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 15 => [
- 'money' => 20000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 16 => [
- 'money' => 20000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 17 => [
- 'money' => 15000000,
- 'pcase' => 1,
- 'unlockgarage' => true,
- 'randombiz' => true
- ],
- 18 => [
- 'money' => 15000000,
- 'pcase' => 1,
- 'unlockgarage' => true,
- 'randombiz' => true
- ],
- 19 => [
- 'money' => 15000000,
- 'pcase' => 1,
- 'unlockgarage' => true,
- 'randombiz' => true
- ],
- 20 => [
- 'exclusivecar' => true
- ],
- 21 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'randomcar' => true
- ],
- 22 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'randomcar' => true
- ],
- 23 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 24 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 25 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 26 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'randombiz' => true
- ],
- 27 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'pet' => true
- ],
- 28 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'pet' => true
- ],
- 29 => [
- 'money' => 10000000,
- 'pcase' => 1,
- 'pet' => true
- ],
- 30 => [
- 'customfunction' => true
- ],
- 31 => [
- 'money' => 5000000,
- 'pcase' => 1,
- 'randompet' => true
- ],
- 32 => [
- 'money' => 5000000,
- 'pcase' => 1,
- 'randompet' => true
- ],
- 33 => [
- 'money' => 5000000,
- 'pcase' => 1,
- 'randompet' => true
- ],
- 34 => [
- 'money' => 5000000,
- 'pcase' => 1,
- 'exp' => 1500
- ],
- 35 => [
- 'money' => 5000000,
- 'pcase' => 1,
- 'exp' => 1000
- ],
- 36 => [
- 'money' => 5000000,
- 'pcase' => 1,
- 'exp' => 500
- ],
- 37 => [
- 'money' => 3000000,
- 'pcase' => 2
- ],
- 38 => [
- 'money' => 3000000,
- 'pcase' => 2
- ],
- 39 => [
- 'money' => 3000000,
- 'pcase' => 2
- ],
- 40 => [
- 'exclusiverang' => true
- ],
- 41 => [
- 'money' => 2000000,
- 'pcase' => 2
- ],
- 42 => [
- 'money' => 2000000,
- 'pcase' => 1
- ],
- 43 => [
- 'money' => 2000000,
- 'clover' => 30
- ],
- 44 => [
- 'money' => 2000000,
- 'clover' => 20
- ],
- 45 => [
- 'money' => 2000000,
- 'clover' => 10
- ],
- 46 => [
- 'money' => 1000000,
- 'case' => 5
- ],
- 47 => [
- 'money' => 1000000,
- 'case' => 5
- ],
- 48 => [
- 'money' => 1000000,
- 'case' => 5
- ],
- 49 => [
- 'pcase' => 1
- ],
- 50 => [
- 'ban' => true
- ]
- ];
- $concurs_users = json_decode(file_get_contents('concurs.json'), true); // concurs.json -- файл с участниками
- for ($x = 0; $x < 50; $x++) shuffle($concurs_users);
- $users = [];
- $text = "🥳 Конкурс окончен!\n\n😧 Всего участников -- " . money(count($concurs_users)) . "\n🤑 Ниже приведены все победители конкурса, поздравляем!\n\n";
- $DB = new exDBase(DB['host'], DB['login'], DB['password'], "nedobot");
- for ($x = 1; $x <= 50; $x++) {
- $newuser = $concurs_users[array_rand($concurs_users)];
- while (in_array($newuser, $users)) $newuser = $concurs_users[array_rand($concurs_users)];
- $users[$x] = $newuser;
- $text .= bNum($x) . " место -- [id" . $newuser . "|" . setName($newuser) . "]\n";
- $user = json_decode(file_get_contents('users/' . $newuser . '.json'), true);
- $temptext = "🥳 " . setName1($newuser) . ", поздравляем, ты победил в конкурсе и занял " . bNum($x) . " место! Твои призы:\n\n";
- if($prizes[$x]['money']) {
- $temptext .= "• " . money($prizes[$x]['money']) . " 💰\n";
- $user['money'] += $prizes[$x]['money'];
- }
- if($prizes[$x]['exp']){
- $temptext .= "• " . money($prizes[$x]['exp']) . " ⭐️\n";
- $user['exp'] += $prizes[$x]['exp'];
- }
- if($prizes[$x]['clover']){
- $temptext .= "• " . money($prizes[$x]['clover']) . " 🍀\n";
- $user['clover'] += $prizes[$x]['clover'];
- }
- if($prizes[$x]['case']){
- $temptext .= "• " . money($prizes[$x]['case']) . " 📦\n";
- $user['cases'] += $prizes[$x]['cases'];
- }
- if($prizes[$x]['pcase']){
- $DB->insert('special_cases', [
- 'user_id' => $newuser,
- 'cases' => 2,
- 'opened' => 0,
- 'pet' => 0,
- 'gradient' => 0,
- 'profilebacks' => 0
- ], false);
- $DB->update('special_cases', ['user_id' => $newuser], ['cases' => $DB->fetchFirst('special_cases', ['user_id' => $newuser], ['cases'])['cases'] + $prizes[$x]['pcase']]);
- $temptext .= "• " . money($prizes[$x]['pcase']) . " 🎁\n";
- }
- if($prizes[$x]['profilechange'] > 0){
- $DB->insert('special_cases', [
- 'user_id' => $newuser,
- 'cases' => 2,
- 'opened' => 0,
- 'pet' => 0,
- 'gradient' => 0,
- 'profilebacks' => 0
- ], false);
- if($prizes[$x]['profilechange'] != 2147483648) {
- $DB->update('special_cases', ['user_id' => $newuser], ['profilebacks' => $DB->fetchFirst('special_cases', ['user_id' => $newuser], ['profilebacks'])['profilebacks'] + $prizes[$x]['profilechange']]);
- $temptext .= "• Возможность сменить фон профиля (+" . $prizes[$x]['profilechange'] . ") 🌄";
- }else{
- $DB->update('special_cases', ['user_id' => $newuser], ['profilebacks' => 2147483648]);
- $temptext .= "• Бесконечное кол-во возможностей сменить фон профиля 🌄";
- }
- }
- if($prizes[$x]['unlockgarage']){
- $garage = $DB->fetchFirst('garage', ['user_id' => $newuser]);
- if($garage){
- if($garage['car3'] === 666){
- $DB->update('garage', ['user_id' => $newuser], ['car3' => 0]);
- $temptext .= "• Разблокировка третьего слота гаража 🔐\n";
- }else $temptext .= "• Разблокировка третьего слота гаража (но у Вас уже разблокирован третий слот, так что данный выигрыш Вы не получаете) 🔐\n";
- }else $temptext .= "• Разблокировка третьего слота гаража (но у Вас нет гаража, так что данный выигрыш Вы не получаете) 🔐\n";
- unset($garage);
- }
- if($prizes[$x]['randomcar']) $temptext .= "• Автомобиль на выбор (напишите @vinogradov.sasha для получения) 🏎\n";
- if($prizes[$x]['randombiz']) $temptext .= "• Здание на выбор (напишите @vinogradov.sasha для получения) 🏭\n";
- if($prizes[$x]['exclusivecar']) $temptext .= "• Эксклюзивное авто (напишите @vinogradov.sasha для получения) 🚜\n";
- if($prizes[$x]['exclusiverang']) $temptext .= "• Эксклюзивный ранг (напишите @vinogradov.sasha для получения) 💎\n";
- if($prizes[$x]['pet']) $temptext .= "• Питомец на выбор (напишите @vinogradov.sasha для получения) 🐰\n";
- if($prizes[$x]['randompet']) $temptext .= "• Случайный питомец (напишите @vinogradov.sasha для получения) 🐰\n";
- if($prizes[$x]['customfunction']) $temptext .= "• Реализация Вашей функции (напишите @vinogradov.sasha для подробностей) 🐣\n";
- if($prizes[$x]['ban']) $temptext .= "• Бан...? Отпиши @vinogradov.sasha для спец. приза 😏\n";
- file_put_contents('users/' . $newuser . '.json', json_encode($user), LOCK_EX);
- MsgSend($temptext . "\n\n🎈 Поздравляем!", $newuser);
- }
- $DB->close();
- file_put_contents('concurs.txt', $text . "\n\nНе огорчайтесь, если не выиграли в этот раз. Повезёт в следующий! 🍀\n\n#!#");
- function bNum($num)
- {
- if ($num == 10) return "🔟";
- $nums = ['0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣'];
- $newnum = "";
- while (strlen($num)) {
- $newnum .= $nums[substr($num, 0, 1)];
- $num = substr($num, 1);
- }
- return $newnum;
- }
- function money($money)
- {
- return number_format($money, 0, '', '.');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement