Real Soccer Game Configuration Variables
Real Soccer Game Configuration Variables
return realSoccerMap;
}
// ------------------------------------------------
// Global Variables
// ------------------------------------------------
var roomName = "️🏆Sân Tập Của Utano🏆";
var roomPassword = null;
var maxPlayers = 30;
var roomPublic = true;
var token = "";
var roomLink = "";
var gameTime = 10; //default game time if 0 is selected
var map = "RSR";
var superAdmins = [];
// -------------------------------------------------
// Classes
// -------------------------------------------------
class Game {
constructor() {
[Link] = 0;
[Link] = false;
[Link];
[Link] = 0;
[Link] = true;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = 1000;
[Link];
[Link];
[Link];
[Link];
[Link] = "";
[Link] = 0;
[Link] = false;
[Link] = false;
[Link] = 0;
[Link];
[Link] = false;
[Link] = false;
[Link];
[Link] = false;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = false;
}
[Link] = id;
[Link] = name;
[Link] = team;
}
}
[Link](getRealSoccerMap());
[Link](0);
[Link](10);
[Link] = function(url) {
roomLink = url;
[Link](roomLink);
}
[Link] = function(newStadiumName, byPlayer) {
if (byPlayer != null) {
map = "custom";
}
else {
map = "RSR";
}
}
[Link] = function(player) {
[Link]([Link] + " joined the room");
whisper("⚽ chào mừng đến với sân tập của Utano ⚽", [Link],
0x61ddff, "bold", 0);
whisper("⚽ ghi !help để biết thêm ⚽", [Link], 0x61e7ff, "bold",
0);
displayAdminMessage();
}
[Link] = function(player) {
displayAdminMessage();
[Link]([Link] + " left the room");
[Link] = function(byPlayer) {
if (map == "RSR") {
[Link](0, {invMass: 1.05});
if (byPlayer == null) {
game = new Game();
announce("Game length set to " + gameTime + " minutes");
}
else {
if ([Link]().timeLimit != 0) {
gameTime = [Link]().timeLimit / 60;
}
else {
gameTime = 10;
}
[Link]();
[Link](0);
[Link]();
}
}
}
[Link] = function(byPlayer) {
if (map == "RSR") {
if (byPlayer != null) {
[Link](gameTime);
}
}
}
[Link] = function(player) {
if (map == "RSR") {
[Link] = [Link];
[Link]([Link], [Link], [Link]);
if ([Link] == true) {
var players = [Link]().filter((player) => [Link]
!= 0);
[Link](function(player) {
if
([Link]([Link]).[Link](1) != 0.3) {
[Link]([Link], {invMass:
0.3});
}
});
}
[Link] = true;
[Link] = false;
[Link](1, {x: 2000, y: 2000 });
[Link](2, {x: 2000, y: 2000 });
[Link](0, {color: "0xffffff"});
[Link] = 1000000;
[Link]++;
[Link] = false;
[Link] = false;
[Link] = "";
}
if ([Link] > 1) {
var pmMsg = args[1];
var players = [Link]();
var pmSent = false;
[Link](function(pmPlayer) {
if ([Link] === args[0] || [Link] ===
args[0].replace(/_/g, ' ')) {
whisper("[PM > " + [Link] + "] " +
[Link] + ": " + pmMsg, [Link], 0xff20ff, "normal", 1);
whisper("[PM] " + [Link] + ": " + pmMsg,
[Link], 0xff20ff, "normal", 1);
pmSent = true;
}
});
if (pmSent == false) {
whisper("Cannot find user '" + args[0] + "'",
[Link], 0xff20ff, "normal", 1);
}
return false;
}
}
}
}
[Link] = function(team) {
if (map == "RSR") {
[Link] = false;
[Link] = function() {
if (map == "RSR") {
if ([Link] == true) {
[Link](true);
[Link] = false;
announce("END");
}
}
}
[Link] = function() {
if (map == "RSR") {
updateGameStatus();
handleBallTouch();
realSoccerRef();
}
}
function realSoccerRef() {
blockThrowIn();
blockGoalKick();
removeBlock();
if ([Link] == gameTime * 60 && [Link] == false) {
extraTime();
[Link] = true;
}
if ([Link] < 99999 && [Link] == false && [Link] == false &&
[Link] == true) {
[Link]++;
}
if ([Link] == true) {
[Link]++;
}
if ([Link] == true) {
if (([Link]().y > 611.45 || [Link]().y < -
611.45)) {
[Link] = false;
if ([Link] == true) {
[Link](true);
[Link] = false;
announce("END");
}
if ([Link] == 1) {
[Link](3, {x: [Link], y:
[Link], radius: 18 });
sleep(100).then(() => {
[Link] = "blueThrow";
[Link] = false;
[Link] = 0;
[Link] = true;
[Link](0, {xspeed: 0, yspeed: 0, x:
[Link], y: [Link], xgravity: 0, ygravity: 0});
//announce(" Throw In: 🔵 Blue");
[Link](0, {color: "0x0fbcf9"});
});
sleep(100).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
else {
[Link](3, {x: [Link], y:
[Link], radius: 18 });
sleep(100).then(() => {
[Link] = "redThrow";
[Link] = false;
[Link] = 0;
[Link] = true;
[Link](0, {xspeed: 0, yspeed: 0, x:
[Link], y: [Link], xgravity: 0, ygravity: 0});
//announce(" Throw In: 🔴 Red");
[Link](0, {color: "0xff3f34"});
});
sleep(100).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
}
if ([Link] == 1) {
[Link](3, {x: 1060, y: 0, radius: 18 });
sleep(100).then(() => {
[Link] = "blueGK";
[Link] = 0;
[Link] = true;
//announce("🥅 Goal Kick: 🔵 Blue");
[Link] = true;
[Link] = 0;
[Link] = 0;
[Link] = false;
[Link](0, {xspeed: 0, yspeed: 0, x:
1060, y: 0, color: "0x0fbcf9", cMask: 268435519, xgravity: 0, ygravity: 0});
});
sleep(3000).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
else {
//announce("🚩 Corner Kick: 🔴 Red");
[Link] = 0;
if ([Link]().y < -124) {
[Link](3, {x: 1140, y: -590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "redCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: 1140, y: -590,
xspeed: 0, yspeed: 0, color: "0xff3f34", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](2, {x: 1150, y: -670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
if ([Link]().y > 124) {
[Link](3, {x: 1140, y: 590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "redCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: 1140, y: 590,
xspeed: 0, yspeed: 0, color: "0xff3f34", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](2, {x: 1150, y: 670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
}
}
if ([Link]().x < -1161.45 && ([Link]().y >
124 || [Link]().y < -124)) {
[Link] = false;
if ([Link] == true) {
[Link](true);
[Link] = false;
announce("END");
}
[Link](0, {xgravity: 0, ygravity: 0});
[Link]().forEach(function(player) {
[Link]([Link], {invMass: 100000});
});
if ([Link] == 1) {
//announce("🚩 Corner Kick: 🔵 Blue");
[Link] = 0;
if ([Link]().y < -124) {
[Link](3, {x: -1140, y: -590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "blueCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: -1140, y: -590,
xspeed: 0, yspeed: 0, color: "0x0fbcf9", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](1, {x: -1150, y: -670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
if ([Link]().y > 124) {
[Link](3, {x: -1140, y: 590, radius:
18 });
sleep(100).then(() => {
[Link] = true;
[Link] = "blueCK";
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = false;
[Link](0, {x: -1140, y: 590,
xspeed: 0, yspeed: 0, color: "0x0fbcf9", cMask: 268435519, xgravity: 0, ygravity:
0});
[Link](1, {x: -1150, y: 670,
radius: 420 });
[Link](3, {x: 0, y: 2000,
radius: 0});
});
}
}
else {
[Link](3, {x: -1060, y: 0, radius: 18 });
sleep(100).then(() => {
[Link] = "redGK";
[Link] = 0;
[Link] = true;
//announce("🥅 Goal Kick: 🔴 Red");
[Link] = true;
[Link] = 0;
[Link] = 0;
[Link] = false;
[Link](0, {xspeed: 0, yspeed: 0, x: -
1060, y: 0, color: "0xff3f34", cMask: 268435519, xgravity: 0, ygravity: 0});
});
sleep(3000).then(() => {
[Link](3, {x: 0, y: 2000, radius:
0});
});
}
}
}
}
function handleBallTouch() {
var players = [Link]();
var ballPosition = [Link]();
var ballRadius = [Link];
var playerRadius = 15;
var triggerDistance = ballRadius + playerRadius + 0.01;
for (var i = 0; i < [Link]; i++) { // Iterate over all the players
var player = players[i];
if ( [Link] == null ) continue;
var distanceToBall = pointDistance([Link], ballPosition);
if ( distanceToBall < triggerDistance ) {
[Link] = [Link];
[Link] = false;
function updateGameStatus() {
[Link] = [Link]([Link]().time);
[Link] = [Link](0).radius;
}
function isAdminPresent() {
var players = [Link]();
if ([Link]((player) => [Link]) != null) {
return true;
}
else {
return false;
}
}
function displayAdminMessage() {
if (isAdminPresent() == false && allowPublicAdmin == true) {
announce("No admin present: Type !admin to take control");
}
}
function extraTime() {
var extraSeconds = [Link]([Link] / 60);
[Link] = (gameTime * 60) + extraSeconds;
announce("Extra time: " + extraSeconds + " Seconds", null, null, null, 1);
}
function secondsToMinutes(time) {
// Hours, minutes and seconds
var hrs = ~~(time / 3600);
var mins = ~~((time % 3600) / 60);
var secs = ~~time % 60;
function blockThrowIn() {
var players = [Link]().filter((player) => [Link] != 0);
if ([Link]().y < 0) { // top throw line
if ([Link] == "redThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 2 &&
[Link]([Link]).y < 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y < -460) {
[Link]([Link], {y: -
445});
}
}
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](17).x != 1149) { // show top red
line
[Link](17, {x: 1149});
}
if ([Link](19).x != -1149) { // hide top
blue line
[Link](19, {x: -1149});
}
});
}
if ([Link] == "blueThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 1 &&
[Link]([Link]).y < 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y < -460) {
[Link]([Link], {y: -
445});
}
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](19).x != 1149) { // show top
blue line
[Link](19, {x: 1149});
}
if ([Link](17).x != -1149) { // hide top
red line
[Link](17, {x: -1149});
}
});
}
}
if ([Link]().y > 0) { // bottom throw line
if ([Link] == "redThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 2 &&
[Link]([Link]).y > 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y > 460) {
[Link]([Link], {y:
445});
}
}
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](21).x != 1149) { // show bottom
red line
[Link](21, {x: 1149});
}
if ([Link](23).x != -1149) { // hide bottom
blue line
[Link](23, {x: -1149});
}
});
}
if ([Link] == "blueThrow") {
[Link](function(player) {
if ([Link]([Link]).invMass !=
9999999) {
[Link]([Link], {invMass:
9999999});
}
if ([Link] == 1 &&
[Link]([Link]).y > 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y > 460) {
[Link]([Link], {y:
445});
}
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link](23).x != 1149) { // show bottom
blue line
[Link](23, {x: 1149});
}
if ([Link](21).x != -1149) { // hide bottom
red line
[Link](21, {x: -1149});
}
});
}
}
}
function blockGoalKick() {
var players = [Link]().filter((player) => [Link] != 0);
if ([Link]().x < 0) { // left side red goal kick
if ([Link] == "redGK") {
[Link](function(player) {
if ([Link] == 2 &&
[Link]([Link]).x < 0) {
if ([Link]([Link]).cGroup !=
268435462) {
[Link]([Link],
{cGroup: 268435462});
}
if ([Link].x < -840 && [Link].y > -
320 && [Link].y < 320) {
[Link]([Link], {x: -
825});
}
}
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
});
}
}
if ([Link]().x > 0) { // right side blue goal kick
if ([Link] == "blueGK") {
[Link](function(player) {
if ([Link] == 1 &&
[Link]([Link]).x > 0) {
if ([Link]([Link]).cGroup !=
268435462) {
[Link]([Link],
{cGroup: 268435462});
}
if ([Link].x > 840 && [Link].y > -
320 && [Link].y < 320) {
[Link]([Link], {x:
825});
}
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
});
}
}
}
function removeBlock() {
var players = [Link]().filter((player) => [Link] != 0);
if ([Link] == "") {
[Link](function(player) {
if ([Link] == 1 &&
[Link]([Link]).cGroup != 2) {
[Link]([Link], {cGroup: 2});
}
if ([Link] == 2 &&
[Link]([Link]).cGroup != 4) {
[Link]([Link], {cGroup: 4});
}
});
if ([Link](17).x != -1149) { // hide top red line
[Link](17, {x: -1149});
}
if ([Link](19).x != -1149) { // hide top blue line
[Link](19, {x: -1149});
}
if ([Link](21).x != -1149) { // hide bottom red line
[Link](21, {x: -1149});
}
if ([Link](23).x != -1149) { // hide bottom blue line
[Link](23, {x: -1149});
}
}
}