您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Try to take over the world!
当前为
// ==UserScript== // @name Roblox small server joiner // @namespace https://popcat.click // @version 1.4 // @description Try to take over the world! // @author https://github.com/ahmadinator // @match https://web.roblox.com/games/* // @match https://www.roblox.com/games/* // @icon https://www.google.com/s2/favicons?domain=roblox.com // @license MIT // @grant none // ==/UserScript== (function() { 'use strict'; Number.prototype.between = function(a, b) { var min = Math.min.apply(Math, [a, b]), max = Math.max.apply(Math, [a, b]); return this > min && this < max; }; let SI = 0; let gameIdString = window.location.pathname.split('/')[2]; function join(gameInstances) { let bestServer = 0; let e = 0; for (let server of gameInstances.Collection) { e += 1; let serverPlayerCount = server.CurrentPlayers.length; let maxPlayers = server.Capacity; let serverId = server.Guid; if (bestServer == 0) { bestServer = [serverPlayerCount, serverId]; }; if (serverPlayerCount < bestServer[0]) { bestServer = [serverPlayerCount, serverId]; } if (e == gameInstances.Collection.length) { if (bestServer[0].between(maxPlayers - maxPlayers, Math.round(maxPlayers / 1.5)) && server.UserCanJoin) { try { window.Roblox.GameLauncher.joinGameInstance(parseInt(gameIdString), bestServer[1]); } catch (err) { window.alert(err); } } else { SI -= 10; fetch('https://web.roblox.com/games/getgameinstancesjson?placeId=' + gameIdString + '&startindex=' + SI.toString()) .then(res => res.json()) .then((out) => { join(out); }).catch(err => window.alert(err)); } console.log(bestServer); } } } function round(num) { SI = Math.floor(num / 10) * 10; fetch('https://web.roblox.com/games/getgameinstancesjson?placeId=' + gameIdString + '&startindex=' + SI.toString()) .then(res => res.json()) .then((out) => { if (out.Collection.length > 0) { join(out); } else { round(num - 5); } }).catch(err => window.alert(err)); } function main() { // console.log(gameIdString) window.alert("Joining.."); fetch('https://web.roblox.com/games/getgameinstancesjson?placeId=' + gameIdString + '&startindex=0') .then(res => res.json()) .then((out) => { round(out.TotalCollectionSize); }).catch(err => window.alert(err)); } let button = document.createElement("span"); button.classList.add("btn-secondary-md"); button.innerText = "Join server with least amount of players"; button.onclick = main; document.getElementById("game-instances").prepend(button); })();