Message 1
Message 1
// =========================================================================
// Usefull Links
// ------------------------------------------------
// [Link]
// [Link]
// [Link]
// [Link]
// =========================================================================
return realSoccerMap;
}
// ------------------------------------------------
// Global Variables
// ------------------------------------------------
var roomName = "[FIHA América] Mexico City Room #1";
var roomPassword = "mexico2k25";
var maxPlayers = 24;
var roomPublic = false;
var token = "";
var roomLink = "";
var gameTime = 10; //default game time if 0 is selected
var map = "RSR";
var superAdmins = [];
var firmasConfirmadas = [];
var oficialMode = false;
/* COLORS */
// -------------------------------------------------
// 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] = id;
[Link] = name;
[Link] = team;
}
}
[Link](getRealSoccerMap());
[Link](0);
[Link](10);
[Link] = function(url) {
roomLink = url;
[Link](roomLink);
}
[Link] = function(player) {
[Link]([Link] + " joined the room");
whisper("⚽ Bienvenido a FIHA AMÉRICA ⚽", [Link], 0x61ddff,
"bold", 0);
whisper("⚽ Pon !help para ver comandos ⚽", [Link], 0x61e7ff,
"bold", 0);
whisper("⚽ Discord -> [Link] ⚽", [Link],
0x61e7ff, "bold", 0);
dict[[Link]] = [Link] + "|" + [Link]
displayAdminMessage();
}
[Link] = function(player) {
displayAdminMessage();
[Link]([Link] + " left the room");
[Link] = function(byPlayer) {
if (map == "RSR") {
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] = "";
}
}
else {
whisper("Cannot change map background color while game in
progress", [Link]);
}
}
else if (args[0] == "swap") {
if ([Link]) {
if ([Link] == 1) {
var players = [Link]().filter((player) =>
[Link] != 0 );
if ( [Link] == 0 ) return false;
[Link](function(player) {
if ([Link] == 1) {
[Link]([Link], 2);
}
if ([Link] == 2) {
[Link]([Link], 1);
}
});
announce("🔄 Teams have been swapped");
}
}
else {
whisper("Admin only command", [Link]);
}
}
else if (args[0] == "setpassword" && [Link]) {
if ([Link]([Link]) > -1) {
[Link](args[1]);
roomPassword = args[1];
announce("Password has been changed by " + [Link]);
}
else {
whisper("Only Super Admins can change password",
[Link]);
}
}
else if (args[0] == "clearpassword" && [Link]) {
if ([Link]([Link]) > -1) {
[Link](null);
roomPassword = null;
announce("Password has been cleared by " + [Link]);
}
else {
whisper("Only Super Admins can clear password", [Link]);
}
}
else if (args[0] == "rs" && [Link]) {
if ([Link]() == null) {
[Link](getRealSoccerMap());
}
else {
whisper("Cannot change map while game in progress",
[Link]);
}
}
else if (args[0] == "rr" && [Link]) {
[Link]();
[Link]();
}
else if (args[0] == "bb") {
[Link]([Link], "Bye", false);
}
else if (args[0] == "help") {
displayHelp([Link], args[1]);
}
else if (args[0] == "super") {
let superMsg = "Super Admins: ";
[Link](function(id) {
if ([Link](id) != null || [Link](id) !=
undefined) {
superMsg = superMsg + [Link](id).name + ", ";
}
});
if ([Link] > 0) {
superMsg = [Link](0, -2);
}
else {
superMsg = "There are no super admins present";
}
whisper(superMsg, [Link]);
}
if (args[0] == "firmo") {
if (oficialMode == true) {
[Link]([Link])
let codigo = args[1];
var webhookURL =
"[Link]
B3y9mCDmS79TjsGtRNEdY5QuEELpi3kkdb79yw3";
var webhookNOMBRE = 'Sistema de Firmas';
function discord(mensaje) {
var x = new XMLHttpRequest();
[Link]("POST",webhookURL);
[Link]('Content-type', 'application/json');
var webhook = {
username: webhookNOMBRE,
content: mensaje
};
[Link]([Link](webhook));
}
let splitconn = dict[[Link]].split("|");
let splitconn2 = splitconn[0];
} else {
[Link](`Si estas por jugar un oficial, recorda activar
el "OficialMode" para habilitar las firmas con el comando "!oficial"`, [Link],
firmoColor, "bold")
}
return false;
}
if (args[0] == "oficial") {
if ([Link] == true) {
oficialMode = true;
[Link](`✅OFICIAL MODE HABILITADO, YA PUEDEN FIRMAR.`,
null, successColor, "bold", [Link]);
} else {
[Link](`❌DEBES SER ADMINISTRADOR PARA USAR ESTE
COMANDO.`, [Link], errorColor, "bold");
}
return false;
}
if (args[0] == "oficialoff") {
if ([Link] == true) {
oficialMode = false;
[Link](`⚠ SE DESACTIVO EL MODO PARA OFICIALES, LAS
FIRMAS QUEDAN DESHABILITADAS.`, null, warningColor, "bold", [Link]);
} else {
[Link](`❌DEBES SER ADMINISTRADOR PARA USAR ESTE
COMANDO.`, [Link], errorColor, "bold");
}
return false;
}
if (args [0] == "firmas") {
let firmasMsg = "Firmas: ";
[Link](function(id) {
if ([Link](id) != null ||
[Link](id) != undefined) {
firmasMsg = firmasMsg +
[Link](id).name + ", ";
}
});
if ([Link] > 0) {
firmasMsg = [Link](0, -2);
}
else {
firmasMsg = "Nadie firmo aún.";
}
whisper(firmasMsg, [Link]);
return false;
}
}
if ([Link]("t ")) {
teamMsg = [Link](1).trim();
if ([Link] == 1) {
var players = [Link]().filter((player) => [Link]
== 1);
[Link](function(teamPlayer) {
[Link]("[Team] " + [Link] + ": " +
teamMsg, [Link], 0xED6A5A, "normal", 1);
});
}
if ([Link] == 2) {
var players = [Link]().filter((player) => [Link]
== 2);
[Link](function(teamPlayer) {
[Link]("[Team] " + [Link] + ": " +
teamMsg, [Link], 0x5995ED, "normal", 1);
});
}
if ([Link] == 0) {
var players = [Link]().filter((player) => [Link]
== 0);
[Link](function(teamPlayer) {
[Link]("[Spec] " + [Link] + ": " +
teamMsg, [Link], 0xdee7fa, "normal", 1);
});
}
return false;
}
if ([Link]("@@")) {
message = [Link](2).trim();
if ([Link](' ') !== -1) {
let args = [Link](/^(\S+)\s(.*)/).slice(1);
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] == [Link] && [Link] == false) {
announce("Last play", null, null, null, 1);
[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) {
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});
});
}
}
}
if ([Link]().[Link](1) == [Link](1)
&& [Link]().[Link](1) == [Link](1)) {
[Link] = false;
[Link] = false;
}
}
}
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] == 2 &&
[Link]([Link]).y < 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y < -485) {
[Link]([Link], {y: -
470});
}
}
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] == 1 &&
[Link]([Link]).y < 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y < -485) {
[Link]([Link], {y: -
470});
}
}
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] == 2 &&
[Link]([Link]).y > 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y > 485) {
[Link]([Link], {y:
470});
}
}
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] == 1 &&
[Link]([Link]).y > 0) {
if ([Link]([Link]).cGroup !=
536870918) {
[Link]([Link],
{cGroup: 536870918});
}
if ([Link].y > 485) {
[Link]([Link], {y:
470});
}
}
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});
}
}
}
function rfc3986EncodeURIComponent(str) {
return encodeURIComponent(str).replace(/[!'()*]/g, escape);
}