Marbella AF 4V4 Game Setup Guide
Marbella AF 4V4 Game Setup Guide
/* ROOM */
var llamaradminWebhook =
'[Link]
MxcADixnpLtvgE6vU-Kn-Rb_uupEQZnHVEChdcU'
var roomWebhook =
'[Link]
SOgF2lcjGrSRRkiS1t7j4wKJy1gL40LyUl3H_6P';
var gameWebhook =
'[Link]
tiCTGPZ767tmFibNVwOuEPWW7mQMeHHB2ZR2wm4Pj5V';
var fetchRecordingVariable = true;
var timeLimit = 4;
var scoreLimit = 3;
var gameConfig = {
roomName: roomName,
maxPlayers: maxPlayers,
public: roomPublic,
noPlayer: true,
geo: geo[0]
}
];
const frasesAsiten = [
" Y con la pedazo de asistencia de",
" Gracias a la buena colocación de",
" Asistencia fenomenal de",
" Y la tremeda asistencia de",
" Que centro de",
" Dios! Que vision tiene",
" Lo que coloca",
" Eres el puskas de asistencia"
];
[Link](scoreLimit);
[Link](timeLimit);
[Link](true);
[Link](6, 0, 0);
/* OPTIONS */
/* OBJECTS */
class Goal {
constructor(time, team, striker, assist) {
[Link] = time;
[Link] = team;
[Link] = striker;
[Link] = assist;
}
}
class Game {
constructor() {
[Link] = [Link]();
[Link] = [Link]();
[Link] = getStartingLineups();
[Link] = [];
[Link] = [Link]();
[Link] = [];
}
}
class PlayerComposition {
constructor(player, auth, timeEntry, timeExit) {
[Link] = player;
[Link] = auth;
[Link] = timeEntry;
[Link] = timeExit;
[Link] = 0;
[Link] = 0;
}
}
class MutePlayer {
constructor(name, id, auth) {
[Link] = [Link]();
[Link] = name;
[Link] = id;
[Link] = auth;
[Link] = null;
}
static incrementId() {
if (![Link]) [Link] = 1
else [Link]++
return [Link]
}
setDuration(minutes) {
[Link] = setTimeout(() => {
[Link](
`Has sido desmuteado!.`,
[Link],
announcementColor,
"bold",
[Link]
);
[Link]();
}, minutes * 60 * 1000);
[Link](this);
}
remove() {
[Link] = null;
[Link]([Link]);
}
}
class MuteList {
constructor() {
[Link] = [];
}
add(mutePlayer) {
[Link](mutePlayer);
return mutePlayer;
}
getById(id) {
var index = [Link](mutePlayer => [Link] === id);
if (index !== -1) {
return [Link][index];
}
return null;
}
getByPlayerId(id) {
var index = [Link](mutePlayer => [Link] ===
id);
if (index !== -1) {
return [Link][index];
}
return null;
}
getByAuth(auth) {
var index = [Link](mutePlayer => [Link] ===
auth);
if (index !== -1) {
return [Link][index];
}
return null;
}
removeById(id) {
var index = [Link](mutePlayer => [Link] === id);
if (index !== -1) {
[Link](index, 1);
}
}
removeByAuth(auth) {
var index = [Link](mutePlayer => [Link] ===
auth);
if (index !== -1) {
[Link](index, 1);
}
}
}
class BallTouch {
constructor(player, time, goal, position) {
[Link] = player;
[Link] = time;
[Link] = goal;
[Link] = position;
}
}
class HaxStatistics {
constructor(playerName = '') {
[Link] = playerName;
[Link] = 0;
[Link] = 0;
[Link] = '0.00%';
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
}
}
/* PLAYERS */
/* STATS */
var possession = [0, 0];
var actionZoneHalf = [0, 0];
var lastWinner = [Link];
var streak = 0;
/* AUTH */
/* COMMANDS */
var commands = {
help: {
aliases: ['commands', 'ayuda', 'comandos' ],
roles: [Link],
desc: `
Estos son todos los comandos dispobibles. Recuerda que depede de tu rango
para ejecutar alguno
Ejemplo para obtener ayuda sobre un comando: \'!help bb\' mostrará la
descripción del \'bb\' .`,
function: helpCommand,
},
claim: {
aliases: [],
roles: [Link],
desc: false,
function: masterCommand,
},
afk: {
aliases: [],
roles: [Link],
desc: `
Este comando te hace ir a AFK.
Tiene restricciones: 1 minuto mínimo de tiempo AFK, 5 minutos como máximo y
10 minutos de reutilización.`,
function: afkCommand,
},
afks: {
aliases: ['afklist'],
roles: [Link],
desc: `
Este comando muestra a todos los jugadores que esta afk.`,
function: afkListCommand,
},
bb: {
aliases: ['salir', 'adios', 'cya'],
roles: [Link],
desc: `
Este comando te hace salir al instante (uso recomendado).`,
function: leaveCommand,
},
me: {
aliases: ['stat', 'stats'],
roles: [Link],
desc: `
Este comando muestra sus estadísticas globales en la sala.`,
function: globalStatsCommand,
},
rename: {
aliases: [],
roles: [Link],
desc: `
Este comando te permite cambiarte el nombre de la tabla de
clasificación.`,
function: renameCommand,
},
games: {
aliases: [],
roles: [Link],
desc: `
Este comando muestra a los 5 mejores jugadores con mas partidos de la
sala.`,
function: statsLeaderboardCommand,
},
wins: {
aliases: [],
roles: [Link],
desc: `
Este comando muestra a los 5 mejores jugadores con la mayor cantidad de
victorias en la sala.`,
function: statsLeaderboardCommand,
},
goals: {
aliases: [],
roles: [Link],
desc: `
Este comando muestra a los 5 mejores jugadores con la mayor cantidad de
goles de la sala.`,
function: statsLeaderboardCommand,
},
assists: {
aliases: [],
roles: [Link],
desc: `
Este comando muestra a los 5 mejores jugadores con la mayor cantidad de
asistencias en la sala.`,
function: statsLeaderboardCommand,
},
cs: {
aliases: [],
roles: [Link],
desc: `
Este comando muestra a los 5 mejores jugadores con la mayor cantidad de
CS de la sala.`,
function: statsLeaderboardCommand,
},
playtime: {
aliases: [],
roles: [Link],
desc: `x
Este comando muestra a los 5 mejores jugadores con la mayor cantidad de
tiempo en la sala.`,
function: statsLeaderboardCommand,
},
discord: {
aliases: ['chat', 'server', 'dc', 'servidor', 'vehax', 'link'],
roles: [Link],
desc: `
Este comando te dara un enlace de invitacion para unirte a nuestro
discord oficial.`,
function: discordCommand,
},
llamaradmin: {
aliases: ['calladmin', 'llamar', 'llamar admin'],
roles: [Link],
desc: `
Para llamar un admin.`,
function: llamarAdmin,
},
frase: {
aliases: ['frases', 'frase de motivacion', 'frase diaria'],
roles: [Link],
desc: `
Obtener lista de ultimas actualizaciones.`,
function: frasesCommand,
},
log: {
aliases: ['changelog', 'cambios', 'update'],
roles: [Link],
desc: `
Para obtener una frase de motivacion.`,
function: logCommand,
},
inforank: {
aliases: [''],
roles: [Link],
desc: `
Para obtener una frase de motivacion.`,
function: infoRoles,
},
anunciar: {
aliases: ['a', 'anuncio'],
roles: Role.ADMIN_PERM,
desc: `
Comando para hacer anuncios en la sala.`,
function: anunciarCommand,
},
training: {
aliases: ['entrenamiento', 'sin goles', 'practica'],
roles: Role.ADMIN_TEMP,
desc: `
This command loads the classic training stadium.`,
function: stadiumCommand,
},
classic: {
aliases: ['futsalx2', 'futsalx1', 'mapa1v1', 'mapa2v2'],
roles: Role.ADMIN_TEMP,
desc: `
This command loads the classic stadium.`,
function: stadiumCommand,
},
big: {
aliases: ['futsalx3', 'futsal', 'mapa3v3',],
roles: Role.ADMIN_TEMP,
desc: `
This command loads the big stadium.`,
function: stadiumCommand,
},
rr: {
aliases: ['reiniciar'],
roles: Role.ADMIN_TEMP,
desc: `
Con este comando reinicias el partido`,
function: restartCommand,
},
rrs: {
aliases: [],
roles: Role.ADMIN_TEMP,
desc: `
Con este comando reinicias y cambias de lugar los equipos`,
function: restartSwapCommand,
},
swap: {
aliases: ['cambiar'],
roles: Role.ADMIN_TEMP,
desc: `
Este comando intercambia a los equipos cuando se detiene el juego.`,
function: swapCommand,
},
kickred: {
aliases: ['kickr'],
roles: Role.ADMIN_TEMP,
desc: `
This command kicks all the players from the red team, including the player
that entered the command. You can give as an argument the reason of the kick.`,
function: kickTeamCommand,
},
kickblue: {
aliases: ['kickb'],
roles: Role.ADMIN_TEMP,
desc: `
This command kicks all the players from the blue team, including the player
that entered the command. You can give as an argument the reason of the kick.`,
function: kickTeamCommand,
},
kickspec: {
aliases: ['kicks'],
roles: Role.ADMIN_TEMP,
desc: `
This command kicks all the players from the spectators team, including the
player that entered the command. You can give as an argument the reason of the
kick.`,
function: kickTeamCommand,
},
mute: {
aliases: ['m'],
roles: Role.ADMIN_TEMP,
desc: `
This command allows to mute a player. He won't be able to talk for a
certain duration, and can be unmuted at any time by admins.
It takes 2 arguments:
Argument 1: #<id> where <id> is the id of the player targeted. This won't
work if the player is an admin.
Argument 2 (optional): <duration> where <duration> is the duration of the
mute in minutes. If no value is provided, the mute lasts for the default duration,
${muteDuration} minutes.
Example: !mute #3 20 will mute the player with id 3 for 20 minutes.`,
function: muteCommand,
},
unmute: {
aliases: ['um'],
roles: Role.ADMIN_TEMP,
desc: `
This command allows to unmute someone.
It takes 1 argument:
Argument 1: #<id> where <id> is the id of the muted player.
OR
Argument 1: <number> where <number> is the number associated with the mute
given by the 'muteList' command.
Example: !unmute #300 will unmute the player with id 300,
!unmute 8 will unmute the n°8 player according to the 'muteList'
command.`,
function: unmuteCommand,
},
mutes: {
aliases: [],
roles: Role.ADMIN_TEMP,
desc: `
Este comando muestra la lista de jugadores muteados.`,
function: muteListCommand,
},
clearbans: {
aliases: [],
roles: [Link],
desc: `
Este comando no es a [Link]én puede desahogar a un jugador en
particular, agregando su identificación como argumento.`,
function: clearbansCommand,
},
bans: {
aliases: ['banlist'],
roles: [Link],
desc: `
Este comando muestra a todos los jugadores que fueron prohibidos y sus
ID.`,
function: banListCommand,
},
admins: {
aliases: ['adminlist'],
roles: [Link],
desc: `
Este comando muestra a todos los jugadores que son administradores
permanentes.`,
function: adminListCommand,
},
setadmin: {
aliases: ['admin'],
roles: [Link],
desc: `
This command allows to set someone as admin. He will be able to connect as
admin, and can be removed at any time by masters.
It takes 1 argument:
Argument 1: #<id> where <id> is the id of the player targeted.
Example: !setadmin #3 will give admin to the player with id 3.`,
function: setAdminCommand,
},
removeadmin: {
aliases: ['unadmin'],
roles: [Link],
desc: `
This command allows to remove someone as admin.
It takes 1 argument:
Argument 1: #<id> where <id> is the id of the player targeted.
OR
Argument 1: <number> where <number> is the number associated with the admin
given by the 'admins' command.
Example: !removeadmin #300 will remove admin to the player with id 300,
!removeadmin 2 will remove the admin n°2 according to the 'admins'
command.`,
function: removeAdminCommand,
},
password: {
aliases: ['pw'],
roles: [Link],
desc: `
Este comando permite agregar una contraseña a la habitación.
Se necesita 1 argumento:
Argumento 1: <Password> Where <Password> es la contraseña que desea para la
habitación.
/* Rangos */
/* FUNCIONES DE INFORMACION DE ROLES */
/* FUNCIONES DE INFORMACION DE ROLES */
[Link](
" 「
𝗣 𝗿𝗶𝗻 𝗰𝗶𝗽 𝗶𝗮 𝗻 𝘁𝗲 」
(>8)",
[Link],
0x174dff,
MessageColorWhite,
"bold"
);
[Link](
" 「
𝗣 𝗿𝗶𝗻 𝗰𝗶𝗽 𝗶𝗮 𝗻 𝘁𝗲 」
(>8)",
[Link],
0x174dff,
[Link],
"bold"
);
[Link](
"😎 「𝗔 𝗽 𝗿𝗲 𝗻 𝗱 𝗶𝘇」
(>20)",
[Link],
0x2EFEF7,
MessageColorBlue,
"bold"
);
"⚽ 𝗣𝗿𝗼𝗳𝗲𝘀𝗶𝗼𝗻𝗮𝗹(>35)",
[Link](
[Link],
0x04B404,
MessageColorBlack,
"bold"
);
"🥊 𝗜𝗺𝗽𝗮𝗿𝗮𝗯𝗹𝗲(>49)",
[Link](
[Link],
0xFE2E2E,
MessageColorRed,
"bold"
);
[Link](
"👽 「
𝗩 𝗲 𝘁𝗲 𝗿𝗮 𝗻 𝗼 」
(>58)",
[Link],
0x73EC59,
MessageColor
);
[Link](
"💪 「
𝗥 𝗲 𝘃 𝗲 𝗹𝗮 𝗰𝗶𝗼 𝗻 」
(>68)",
[Link],
0xFA58DF,
"bold"
);
[Link](
"🥈 「
𝐄 𝐱 𝐩 𝐞 𝐫𝐭𝐨 」(>80)",
[Link],
0xEC77CE,
"bold"
);
[Link]("🥇 「
𝗟𝗲 𝘆 𝗲 𝗻 𝗱 𝗮 」
(>98)", [Link], 0xBFFF00, "bold");
[Link]("💫 「
𝗘 𝘀𝘁𝗿𝗲 𝗹𝗹𝗮 」
(>179)", [Link], 0xFF7900, "bold");
[Link]("💎𝗦𝘂𝗽𝗲𝗿-𝗘𝘀𝘁𝗿𝗲𝗹𝗹𝗮」(>199)", [Link], 0x0040FF, "bold");
[Link]("🔥 「
𝐆𝐎𝐀𝐓」 (>399)", [Link], 0xFF8000, "bold");
}
$rank_colors = array(
'admin' = 'red',
'moderator' = 'green',
'vip' = 'blue',
'normal' ='black',
);
$rank_colors['admin'] = 4122;
$rank_colors['moderator'] = 4123;
$rank_colors['vip'] = 4124;
$rank_colors['normal'] = 4125;
/* GAME */
/* COLORS */
/* AUXILIARY */
var stopTimeout;
var startTimeout;
var unpauseTimeout;
var removingTimeout;
var insertingTimeout;
var emptyPlayer = {
id: 0,
};
stadiumCommand(emptyPlayer, "!training");
/* FUNCTIONS */
/* AUXILIARY FUNCTIONS */
function getDate() {
let d = new Date();
return [Link]() + ' ' + [Link]();
}
/* MATH FUNCTIONS */
function getRandomInt(max) {
// returns a random number between 0 and max-1
return [Link]([Link]() * [Link](max));
}
/* TIME FUNCTIONS */
function getHoursStats(time) {
return [Link](time / 3600);
}
function getMinutesGame(time) {
var t = [Link](time / 60);
return `${[Link](t / 10)}${[Link](t % 10)}`;
}
function getMinutesReport(time) {
return [Link]([Link](time) / 60);
}
function getMinutesEmbed(time) {
var t = [Link]([Link](time) / 60);
return `${[Link](t / 10)}${[Link](t % 10)}`;
}
function getMinutesStats(time) {
return [Link](time / 60) - getHoursStats(time) * 60;
}
function getSecondsGame(time) {
var t = [Link](time - [Link](time / 60) * 60);
return `${[Link](t / 10)}${[Link](t % 10)}`;
}
function getSecondsReport(time) {
var t = [Link](time);
return [Link](t - getMinutesReport(t) * 60);
}
function getSecondsEmbed(time) {
var t = [Link](time);
var t2 = [Link](t - [Link](t / 60) * 60);
return `${[Link](t2 / 10)}${[Link](t2 % 10)}`;
}
function getTimeGame(time) {
return `[${getMinutesGame(time)}:${getSecondsGame(time)}]`;
}
function getTimeEmbed(time) {
return `[${getMinutesEmbed(time)}:${getSecondsEmbed(time)}]`;
}
function getTimeStats(time) {
if (getHoursStats(time) > 0) {
return `${getHoursStats(time)}h${getMinutesStats(time)}m`;
} else {
return `${getMinutesStats(time)}m`;
}
}
function getGoalGame() {
return [Link] + [Link];
}
/* REPORT FUNCTIONS */
function findFirstNumberCharString(str) {
let str_number = str[[Link](/[0-9]/g)];
return str_number === undefined ? "0" : str_number;
}
function getIdReport() {
var d = new Date();
return `${[Link]() % 100}${[Link]() < 9 ? '0' : ''}$
{[Link]() + 1}${[Link]() < 10 ? '0' : ''}${[Link]()}${[Link]() < 10 ?
'0' : ''}${[Link]()}${[Link]() < 10 ? '0' : ''}${[Link]()}$
{[Link]() < 10 ? '0' : ''}${[Link]()}$
{findFirstNumberCharString(roomName)}`;
}
function getRecordingName(game) {
let d = new Date();
let redCap = [Link][0][0] != undefined ? [Link][0]
[0].[Link] : 'Red';
let blueCap = [Link][1][0] != undefined ? [Link][1]
[0].[Link] : 'Blue';
let day = [Link]() < 10 ? '0' + [Link]() : [Link]();
let month = [Link]() < 10 ? '0' + ([Link]() + 1) : ([Link]() +
1);
let year = [Link]() % 100 < 10 ? '0' + ([Link]() % 100) :
([Link]() % 100);
let hour = [Link]() < 10 ? '0' + [Link]() : [Link]();
let minute = [Link]() < 10 ? '0' + [Link]() : [Link]();
return `${day}-${month}-${year}-${hour}h${minute}-${redCap}vs$
{blueCap}.hbr2`;
}
function fetchRecording(game) {
if (gameWebhook != "") {
let form = new FormData();
[Link](null, new File([[Link]], getRecordingName(game),
{ "type": "text/plain" }));
[Link]("payload_json", [Link]({
"username": roomName
}));
fetch(gameWebhook, {
method: 'POST',
body: form,
}).then((res) => res);
}
}
/* FEATURE FUNCTIONS */
function getCommand(commandStr) {
if ([Link](commandStr)) return commandStr;
for (const [key, value] of [Link](commands)) {
for (let alias of [Link]) {
if (alias == commandStr) return key;
}
}
return false;
}
function getPlayerComp(player) {
if (player == null || [Link] == 0) return null;
var comp = [Link];
var index = comp[0].findIndex((c) => [Link] == authArray[[Link]][0]);
if (index != -1) return comp[0][index];
index = comp[1].findIndex((c) => [Link] == authArray[[Link]][0]);
if (index != -1) return comp[1][index];
return null;
}
[Link] = function(player,message){
if(Role.ADMIN_TEMP){
[Link](`${adminPrefix}${[Link]}: $
{message}`,messageTarget,[Link],[Link],[Link]
);
return false;
}
else{
[Link](`${[Link]}: $
{message}`,messageTarget,[Link],[Link],[Link]
mal);
return false;
}
}
[Link](
messageFrom,
[Link],
privateMessageColor,
'bold',
[Link]
);
[Link](
messageTo,
[Link],
privateMessageColor,
'bold',
[Link]
);
}
/* PHYSICS FUNCTIONS */
function calculateStadiumVariables() {
if (checkStadiumVariable && [Link] + [Link] > 0) {
checkStadiumVariable = false;
setTimeout(() => {
let ballDisc = [Link](0);
let playerDisc =
[Link]([Link](teamBlue)[0].id);
ballRadius = [Link];
playerRadius = [Link];
triggerDistance = ballRadius + playerRadius + 0.01;
speedCoefficient = 100 / (5 * [Link] * ([Link]
** 60 + 1));
}, 1);
}
}
/* BUTTONS */
function topButton() {
if ([Link] > 0) {
if ([Link] == [Link] && [Link] > 1) {
[Link](teamSpec[0].id, [Link]);
[Link](teamSpec[1].id, [Link]);
} else if ([Link] < [Link])
[Link](teamSpec[0].id, [Link]);
else [Link](teamSpec[0].id, [Link]);
}
}
function randomButton() {
if ([Link] > 0) {
if ([Link] == [Link] && [Link] > 1) {
var r = getRandomInt([Link]);
[Link](teamSpec[r].id, [Link]);
teamSpec = [Link]((spec) => [Link] != teamSpec[r].id);
[Link](teamSpec[getRandomInt([Link])].id,
[Link]);
} else if ([Link] < [Link])
[Link](teamSpec[getRandomInt([Link])].id,
[Link]);
else
[Link](teamSpec[getRandomInt([Link])].id,
[Link]);
}
}
function blueToSpecButton() {
clearTimeout(removingTimeout);
removingPlayers = true;
removingTimeout = setTimeout(() => {
removingPlayers = false;
}, 100);
for (var i = 0; i < [Link]; i++) {
[Link](teamBlue[[Link] - 1 - i].id,
[Link]);
}
}
function redToSpecButton() {
clearTimeout(removingTimeout);
removingPlayers = true;
removingTimeout = setTimeout(() => {
removingPlayers = false;
}, 100);
for (var i = 0; i < [Link]; i++) {
[Link](teamRed[[Link] - 1 - i].id,
[Link]);
}
}
function resetButton() {
clearTimeout(removingTimeout);
removingPlayers = true;
removingTimeout = setTimeout(() => {
removingPlayers = false;
}, 100);
for (let i = 0; i < [Link]([Link], [Link]); i++) {
if ([Link]([Link], [Link]) - [Link] - i > 0)
[Link](teamBlue[[Link] - 1 - i].id,
[Link]);
else if ([Link]([Link], [Link]) - [Link] -
i > 0)
[Link](teamRed[[Link] - 1 - i].id,
[Link]);
else break;
}
for (let i = 0; i < [Link]([Link], [Link]); i++) {
[Link](
teamBlue[[Link]([Link], [Link]) - 1 - i].id,
[Link]
);
[Link](
teamRed[[Link]([Link], [Link]) - 1 - i].id,
[Link]
);
}
}
function swapButton() {
clearTimeout(removingTimeout);
removingPlayers = true;
removingTimeout = setTimeout(() => {
removingPlayers = false;
}, 100);
for (let player of teamBlue) {
[Link]([Link], [Link]);
}
for (let player of teamRed) {
[Link]([Link], [Link]);
}
}
/* COMMAND FUNCTIONS */
/* PLAYER COMMANDS */
function leaveCommand(player, message) {
[Link]([Link], 'Hasta Luego, Vuelve Pronto!!', false);
}
function discordCommand(player) {
// Verifica que el jugador que ejecutó el comando sea válido
if (player) {
// Define el mensaje con el enlace de Discord
[Link](
`${[Link]}: Este es nuestro Discord:
[Link]
[Link],
blueColor,
'bold',
[Link]
);
}
}
function logCommand(player) {
// Verifica que el jugador que ejecutó el comando sea válido
if (player) {
// Define lista de cambios
[Link](
` Vehax x3
Version 0.75 Beta \n\n`,
[Link],
blancoColor,
'bold',
[Link]
);
[Link](
`
・ Esta vez si se corrigió el bug de x4 ✅
・ Se añadieron frases de goles, asistencias, y og's ✅
・ Se bajo la cantidad de tiempo maxima de inactividad, si duras 10s
inactivo seras kickeado ✅
・ Se bajo el tiempo para pickear, si duras 12s sin pickear seras
kickeado ✅
・ Se añadieron anuncios que se hace cada x tiempo y puede variar
siempre ✅
・ Se añadieron slots para los @Admin Pub , 17 slots, 2 son de admin
✅
・ Se añadio el comando !frase, Este te dirá una frase de motivación
✅
・ Se añadió el comando !votekick + id de jugador ✅ `,
[Link],
moradoColor,
'bold',
[Link]
);
}
}
/* ADMIN COMMANDS */
/* MASTER COMMANDS */
if ( =>
a[0]).includes(authArray[[Link]][0])) {
if () {
[Link]([Link], true);
[Link]([authArray[[Link]][0],
[Link]]);
[Link](
`${[Link]} Es ahora adminnistrador !`,
null,
announcementColor,
'bold',
[Link]
);
} else {
[Link](
`Este jugador ya es rango dueño !`,
[Link],
errorColor,
'bold',
[Link]
);
}
} else {
[Link](
`Ya este jugador es administrador permanente !`,
[Link],
errorColor,
'bold',
[Link]
);
}
} else {
[Link](
`There is no player with such ID in the room. Enter "!help
setadmin" for more information.`,
[Link],
errorColor,
'bold',
[Link]
);
}
} else {
[Link](
`Incorrect format for your argument. Enter "!help setadmin" for
more information.`,
[Link],
errorColor,
'bold',
[Link]
);
}
} else {
[Link](
`Wrong number of arguments. Enter "!help setadmin" for more
information.`,
[Link],
errorColor,
'bold',
[Link]
);
}
}
if ([Link]((a) =>
a[0]).includes(authArray[[Link]][0])) {
[Link]([Link], false);
adminList = [Link]((a) => a[0] !=
authArray[[Link]][0]);
[Link](
`${[Link]} Ya no es administrador de sala !`,
null,
announcementColor,
'bold',
[Link]
);
} else {
[Link](
`¡Este jugador no es un administrador permanente! !`,
[Link],
errorColor,
'bold',
[Link]
);
}
} else {
[Link](
`There is no player with such ID in the room. Enter "!help
removeadmin" for more information.`,
[Link],
errorColor,
'bold',
[Link]
);
}
} else if (msgArray[0].length > 0 && parseInt(msgArray[0]) <
[Link]) {
var index = parseInt(msgArray[0]);
var playerAdmin = adminList[index];
if ([Link]((p) => authArray[[Link]][0] ==
playerAdmin[0]) != -1) {
// check if there is the removed admin in the room
var indexRem = [Link]((p) => authArray[[Link]][0]
== playerAdmin[0]);
[Link](playersAll[indexRem].id, false);
}
[Link](index);
[Link](
`${playerAdmin[1]} Ya no es administrador de sala !`,
null,
announcementColor,
'bold',
[Link]
);
} else {
[Link](
`Incorrect format for your argument. Enter "!help removeadmin"
for more information.`,
[Link],
errorColor,
'bold',
[Link]
);
}
} else {
[Link](
`Wrong number of arguments. Enter "!help removeadmin" for more
information.`,
[Link],
errorColor,
'bold',
[Link]
);
}
}
/* GAME FUNCTIONS */
function checkTime() {
const scores = [Link]();
if (game != undefined) [Link] = scores;
if ([Link]([Link] - [Link]) <= 0.01 && [Link] !=
0 && playSituation == [Link]) {
if ([Link] != [Link]) {
if (!checkTimeVariable) {
checkTimeVariable = true;
setTimeout(() => {
checkTimeVariable = false;
}, 3000);
[Link] > [Link] ? endGame([Link]) :
endGame([Link]);
stopTimeout = setTimeout(() => {
[Link]();
}, 2000);
}
return;
}
if (drawTimeLimit != 0) {
goldenGoal = true;
[Link](
'⚽ Primer Equipo En Hacer Gol Gana !!',
null,
announcementColor,
'bold',
[Link]
);
}
}
if ([Link]([Link] - drawTimeLimit * 60 - [Link]) <= 0.01
&& [Link] != 0) {
if (!checkTimeVariable) {
checkTimeVariable = true;
setTimeout(() => {
checkTimeVariable = false;
}, 10);
endGame([Link]);
[Link]();
goldenGoal = false;
}
}
}
function instantRestart() {
[Link]();
startTimeout = setTimeout(() => {
[Link]();
}, 10);
}
function resumeGame() {
startTimeout = setTimeout(() => {
[Link]();
}, 1000);
setTimeout(() => {
[Link](false);
}, 500);
}
function endGame(winner) {
if ([Link] >= 2 * teamSize - 1) activateChooseMode();
const scores = [Link]();
[Link] = scores;
lastWinner = winner;
endGameVariable = true;
if (winner == [Link]) {
streak++;
[Link](
`✨ El equipo rojo gana ${[Link]} - ${[Link]} ! Racha
actual: ${streak}`,
null,
redColor,
'bold',
[Link]
);
} else if (winner == [Link]) {
streak = 1;
[Link](
`✨ El Equipo Azul Gana ${[Link]} - ${[Link]} ! Racha
Actual🏆: ${streak}`,
null,
blueColor,
'bold',
[Link]
);
} else {
streak = 0;
[Link](
'💤 Límite de dibujo alcanzado !',
null,
announcementColor,
'bold',
[Link]
);
}
let possessionRedPct = (possession[0] / (possession[0] + possession[1])) *
100;
let possessionBluePct = 100 - possessionRedPct;
let possessionString = `🔴 ${[Link](0)}% - $
{[Link](0)}% 🔵`;
let actionRedPct = (actionZoneHalf[0] / (actionZoneHalf[0] +
actionZoneHalf[1])) * 100;
let actionBluePct = 100 - actionRedPct;
let actionString = `🔴 ${[Link](0)}% - $
{[Link](0)}% 🔵`;
let CSString = getCSString(scores);
[Link](
`📊 Posesión: 🔴 ${possessionString}\n` +
`📊 Zona de acción: 🔴 ${actionString}\n` +
`${CSString}`,
null,
announcementColor,
'bold',
[Link]
);
updateStats();
}
/* CHOOSING FUNCTIONS */
function activateChooseMode() {
chooseMode = true;
slowMode = chooseModeSlowMode;
[Link](
`🐢 Modo Lento Cambiado Para Elegir La Duración Del Modo De: $
{chooseModeSlowMode}s.`,
null,
announcementColor,
'bold',
[Link]
);
}
function deactivateChooseMode() {
chooseMode = false;
clearTimeout(timeOutCap);
if (slowMode != defaultSlowMode) {
slowMode = defaultSlowMode;
[Link](
`🐢 Modo Lento Cambiado Para Elegir La Duración Del Modo De: $
{defaultSlowMode}s.`,
null,
announcementColor,
'bold',
[Link]
);
}
redCaptainChoice = '';
blueCaptainChoice = '';
}
function getSpecList(player) {
if (player == null) return null;
var cstm = 'Players : ';
for (let i = 0; i < [Link]; i++) {
cstm += teamSpec[i].name + `[${i + 1}], `;
}
cstm = [Link](0, [Link] - 2) + '.';
[Link](
cstm,
[Link],
infoColor,
'bold',
[Link]
);
}
function choosePlayer() {
clearTimeout(timeOutCap);
let captain;
if ([Link] <= [Link] && [Link] != 0) {
captain = teamRed[0];
} else if ([Link] < [Link] && [Link] != 0) {
captain = teamBlue[0];
}
if (captain != null) {
[Link](
"Para Elegir Un Jugador, Ingrese Su Número En La Lista Dada O Use
'top', 'random' o 'bottom'.",
[Link],
infoColor,
'bold',
[Link]
);
timeOutCap = setTimeout(
(player) => {
[Link](
`Apresúrate ${[Link]}, solo $
{[Link](String(chooseTime / 2))} para elegir!`,
[Link],
warningColor,
'bold',
[Link]
);
timeOutCap = setTimeout(
(player) => {
[Link](
[Link],
"¡No elegiste a tiempo!",
false
);
},
chooseTime * 500,
captain
);
},
chooseTime * 1000,
captain
);
}
if ([Link] != 0 && [Link] != 0) {
getSpecList([Link] <= [Link] ? teamRed[0] : teamBlue[0]);
}
}
/* PLAYER FUNCTIONS */
function updateTeams() {
playersAll = [Link]();
players = [Link]((p) => );
teamRed = [Link]((p) => [Link] == [Link]);
teamBlue = [Link]((p) => [Link] == [Link]);
teamSpec = [Link]((p) => [Link] == [Link]);
}
function updateAdmins(excludedPlayerID = 0) {
if ([Link] != 0 && [Link]((p) => [Link]).length < maxAdmins) {
let playerArray = [Link]((p) => [Link] != excludedPlayerID && !
[Link]);
let arrayID = [Link]((player) => [Link]);
[Link]([Link](...arrayID), true);
}
}
function getRole(player) {
return (
! => a == authArray[[Link]][0]) * 2 +
! => a[0] == authArray[[Link]][0]) * 1 +
[Link] * 1
);
}
function ghostKickHandle(oldP, newP) {
var teamArrayId = getTeamArray([Link], true).map((p) => [Link]);
[Link]([Link]((id) => id == [Link]), 1, [Link]);
/* ACTIVITY FUNCTIONS */
function handleActivityPlayer(player) {
let pComp = getPlayerComp(player);
if (pComp != null) {
[Link]++;
if ([Link] == 60 * ((2 / 3) * afkLimit)) {
[Link](
`⛔ ${[Link]}, si no te mueves o envías un mensaje en los
siguiente ${[Link](afkLimit / 3)} segundos, serás kickeado !`,
[Link],
warningColor,
'bold',
[Link]
);
return;
}
if ([Link] >= 60 * afkLimit) {
[Link] = 0;
if ([Link] <= afkLimit - 0.5) {
setTimeout(() => {
!chooseMode ? instantRestart() : [Link]();
}, 10);
}
[Link]([Link], 'AFK', false);
}
}
}
function handleActivityPlayerTeamChange(changedPlayer) {
if ([Link] == [Link]) {
let pComp = getPlayerComp(changedPlayer);
if (pComp != null) [Link] = 0;
}
}
function handleActivityStop() {
for (let player of players) {
let pComp = getPlayerComp(player);
if (pComp != null) [Link] = 0;
}
}
function handleActivity() {
if (gameState === [Link] && [Link] > 1) {
for (let player of teamRed) {
handleActivityPlayer(player);
}
for (let player of teamBlue) {
handleActivityPlayer(player);
}
}
}
/* LINEUP FUNCTIONS */
function getStartingLineups() {
var compositions = [[], []];
for (let player of teamRed) {
compositions[0].push(
new PlayerComposition(player, authArray[[Link]][0], [0], [])
);
}
for (let player of teamBlue) {
compositions[1].push(
new PlayerComposition(player, authArray[[Link]][0], [0], [])
);
}
return compositions;
}
function handleLineupChangeTeamChange(changedPlayer) {
if (gameState != [Link]) {
var playerLineup;
if ([Link] == [Link]) {
// player gets in red team
var redLineupAuth = [Link][0].map((p) => [Link]);
var ind = [Link]((auth) => auth ==
authArray[[Link]][0]);
if (ind != -1) {
// Player goes back in
playerLineup = [Link][0][ind];
if ([Link]([Link])) {
// gets subbed off then in at the exact same time -> no sub
[Link] = [Link]((t) => t !
= [Link]);
} else {
[Link]([Link]);
}
} else {
playerLineup = new PlayerComposition(
changedPlayer,
authArray[[Link]][0],
[[Link]],
[]
);
[Link][0].push(playerLineup);
}
} else if ([Link] == [Link]) {
// player gets in blue team
var blueLineupAuth = [Link][1].map((p) => [Link]);
var ind = [Link]((auth) => auth ==
authArray[[Link]][0]);
if (ind != -1) {
// Player goes back in
playerLineup = [Link][1][ind];
if ([Link]([Link])) {
// gets subbed off then in at the exact same time -> no sub
[Link] = [Link]((t) => t !
= [Link]);
} else {
[Link]([Link]);
}
} else {
playerLineup = new PlayerComposition(
changedPlayer,
authArray[[Link]][0],
[[Link]],
[]
);
[Link][1].push(playerLineup);
}
}
if ([Link]((r) => [Link] == [Link])) {
// player leaves red team
var redLineupAuth = [Link][0].map((p) => [Link]);
var ind = [Link]((auth) => auth ==
authArray[[Link]][0]);
playerLineup = [Link][0][ind];
if ([Link]([Link])) {
// gets subbed off then in at the exact same time -> no sub
if ([Link] == 0) {
[Link][0].splice(ind, 1);
} else {
[Link] = [Link]((t) => t
!= [Link]);
}
} else {
[Link]([Link]);
}
} else if ([Link]((r) => [Link] == [Link])) {
// player leaves blue team
var blueLineupAuth = [Link][1].map((p) => [Link]);
var ind = [Link]((auth) => auth ==
authArray[[Link]][0]);
playerLineup = [Link][1][ind];
if ([Link]([Link])) {
// gets subbed off then in at the exact same time -> no sub
if ([Link] == 0) {
[Link][1].splice(ind, 1);
} else {
[Link] = [Link]((t) => t
!= [Link]);
}
} else {
[Link]([Link]);
}
}
}
}
function handleLineupChangeLeave(player) {
if (playSituation != [Link]) {
if ([Link] == [Link]) {
// player gets in red team
var redLineupAuth = [Link][0].map((p) => [Link]);
var ind = [Link]((auth) => auth ==
authArray[[Link]][0]);
var playerLineup = [Link][0][ind];
if ([Link]([Link])) {
// gets subbed off then in at the exact same time -> no sub
if ([Link] == 0) {
[Link][0].splice(ind, 1);
} else {
[Link] = [Link]((t) => t
!= [Link]);
}
} else {
[Link]([Link]);
}
} else if ([Link] == [Link]) {
// player gets in blue team
var blueLineupAuth = [Link][1].map((p) => [Link]);
var ind = [Link]((auth) => auth ==
authArray[[Link]][0]);
var playerLineup = [Link][1][ind];
if ([Link]([Link])) {
// gets subbed off then in at the exact same time -> no sub
if ([Link] == 0) {
[Link][1].splice(ind, 1);
} else {
[Link] = [Link]((t) => t
!= [Link]);
}
} else {
[Link]([Link]);
}
}
}
}
function balanceTeams() {
if (!chooseMode) {
if ([Link] == 0) {
[Link]();
[Link](scoreLimit);
[Link](timeLimit);
} else if ([Link] == 1 && [Link] == 0) {
instantRestart();
setTimeout(() => {
stadiumCommand(emptyPlayer, `!training`);
}, 5);
[Link](players[0].id, [Link]);
} else if ([Link]([Link] - [Link]) == [Link] &&
[Link] > 0) {
const n = [Link]([Link] - [Link]);
if ([Link] == 2) {
instantRestart();
setTimeout(() => {
stadiumCommand(emptyPlayer, `!classic`);
}, 5);
}
if ([Link] > [Link]) {
for (var i = 0; i < n; i++) {
[Link](teamSpec[i].id, [Link]);
}
} else {
for (var i = 0; i < n; i++) {
[Link](teamSpec[i].id, [Link]);
}
}
} else if ([Link]([Link] - [Link]) > [Link]) {
const n = [Link]([Link] - [Link]);
if ([Link] == 1) {
instantRestart();
setTimeout(() => {
stadiumCommand(emptyPlayer, `!training`);
}, 5);
[Link](players[0].id, [Link]);
return;
} else if (teamSize > 2 && [Link] == 5) {
instantRestart();
setTimeout(() => {
stadiumCommand(emptyPlayer, `!classic`);
}, 5);
}
if ([Link] == teamSize * 2 - 1) {
teamRedStats = [];
teamBlueStats = [];
}
if ([Link] > [Link]) {
for (var i = 0; i < n; i++) {
[Link](
teamRed[[Link] - 1 - i].id,
[Link]
);
}
} else {
for (var i = 0; i < n; i++) {
[Link](
teamBlue[[Link] - 1 - i].id,
[Link]
);
}
}
} else if ([Link]([Link] - [Link]) < [Link] &&
[Link] != [Link]) {
[Link](true);
activateChooseMode();
choosePlayer();
} else if ([Link] >= 2 && [Link] == [Link] &&
[Link] < teamSize) {
if ([Link] == 2) {
instantRestart();
setTimeout(() => {
stadiumCommand(emptyPlayer, `!big`);
}, 5);
}
topButton();
}
}
}
function handlePlayersJoin() {
if (chooseMode) {
if (teamSize > 2 && [Link] == 6) {
setTimeout(() => {
stadiumCommand(emptyPlayer, `!big`);
}, 5);
}
getSpecList([Link] <= [Link] ? teamRed[0] : teamBlue[0]);
}
balanceTeams();
}
function handlePlayersLeave() {
if (gameState != [Link]) {
var scores = [Link]();
if ([Link] >= 2 * teamSize && [Link] >= (5 / 6) *
[Link] && [Link] != [Link]) {
var rageQuitCheck = false;
if ([Link] < [Link]) {
if ([Link] - [Link] == 2) {
endGame([Link]);
rageQuitCheck = true;
}
} else {
if ([Link] - [Link] == 2) {
endGame([Link]);
rageQuitCheck = true;
}
}
if (rageQuitCheck) {
[Link](
"Ragequit detectado, juego terminado.",
null,
infoColor,
'bold',
[Link]
)
stopTimeout = setTimeout(() => {
[Link]();
}, 100);
return;
}
}
}
if (chooseMode) {
if (teamSize > 2 && [Link] == 5) {
setTimeout(() => {
stadiumCommand(emptyPlayer, `!classic`);
}, 5);
}
if ([Link] == 0 || [Link] == 0) {
[Link](teamSpec[0].id, [Link] == 0 ? [Link] :
[Link]);
return;
}
if ([Link]([Link] - [Link]) == [Link]) {
deactivateChooseMode();
resumeGame();
var b = [Link];
if ([Link] > [Link]) {
for (var i = 0; i < b; i++) {
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
[Link](teamSpec[0].id, [Link]);
}, 5 * i);
}
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 5 * b);
} else {
for (var i = 0; i < b; i++) {
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
[Link](teamSpec[0].id, [Link]);
}, 5 * i);
}
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 5 * b);
}
return;
}
if (streak == 0 && gameState == [Link]) {
if ([Link]([Link] - [Link]) == 2) {
var teamIn = [Link] > [Link] ? teamRed : teamBlue;
[Link](teamIn[[Link] - 1].id, [Link])
}
}
if ([Link] == [Link] && [Link] < 2) {
deactivateChooseMode();
resumeGame();
return;
}
if (capLeft) {
choosePlayer();
} else {
getSpecList([Link] <= [Link] ? teamRed[0] :
teamBlue[0]);
}
}
balanceTeams();
}
function handlePlayersTeamChange(byPlayer) {
if (chooseMode && !removingPlayers && byPlayer == null) {
if ([Link]([Link] - [Link]) == [Link]) {
deactivateChooseMode();
resumeGame();
var b = [Link];
if ([Link] > [Link]) {
for (var i = 0; i < b; i++) {
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
[Link](teamSpec[0].id, [Link]);
}, 5 * i);
}
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 5 * b);
} else {
for (var i = 0; i < b; i++) {
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
[Link](teamSpec[0].id, [Link]);
}, 5 * i);
}
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 5 * b);
}
return;
} else if (
([Link] == teamSize && [Link] == teamSize) ||
([Link] == [Link] && [Link] < 2)
) {
deactivateChooseMode();
resumeGame();
} else if ([Link] <= [Link] && redCaptainChoice != '') {
if (redCaptainChoice == 'top') {
[Link](teamSpec[0].id, [Link]);
} else if (redCaptainChoice == 'random') {
var r = getRandomInt([Link]);
[Link](teamSpec[r].id, [Link]);
} else {
[Link](teamSpec[[Link] - 1].id, [Link]);
}
return;
} else if ([Link] < [Link] && blueCaptainChoice != '') {
if (blueCaptainChoice == 'top') {
[Link](teamSpec[0].id, [Link]);
} else if (blueCaptainChoice == 'random') {
var r = getRandomInt([Link]);
[Link](teamSpec[r].id, [Link]);
} else {
[Link](teamSpec[[Link] - 1].id, [Link]);
}
return;
} else {
choosePlayer();
}
}
}
function handlePlayersStop(byPlayer) {
if (byPlayer == null && endGameVariable) {
if (chooseMode) {
if ([Link] == 2 * teamSize) {
chooseMode = false;
resetButton();
for (var i = 0; i < teamSize; i++) {
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
randomButton();
}, 200 * i);
}
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 200 * teamSize);
startTimeout = setTimeout(() => {
[Link]();
}, 2000);
} else {
if (lastWinner == [Link]) {
blueToSpecButton();
} else if (lastWinner == [Link]) {
redToSpecButton();
setTimeout(() => {
swapButton();
}, 10);
} else {
resetButton();
}
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
topButton();
}, 300);
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 300);
}
} else {
if ([Link] == 2) {
if (lastWinner == [Link]) {
swapButton();
}
startTimeout = setTimeout(() => {
[Link]();
}, 2000);
} else if ([Link] == 3 || [Link] >= 2 * teamSize + 1) {
if (lastWinner == [Link]) {
blueToSpecButton();
} else {
redToSpecButton();
setTimeout(() => {
swapButton();
}, 5);
}
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
topButton();
}, 200);
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 300);
startTimeout = setTimeout(() => {
[Link]();
}, 2000);
} else if ([Link] == 4) {
resetButton();
clearTimeout(insertingTimeout);
insertingPlayers = true;
setTimeout(() => {
randomButton();
setTimeout(() => {
randomButton();
}, 500);
}, 500);
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 2000);
startTimeout = setTimeout(() => {
[Link]();
}, 2000);
} else if ([Link] == 5 || [Link] >= 2 * teamSize + 1) {
if (lastWinner == [Link]) {
blueToSpecButton();
} else {
redToSpecButton();
setTimeout(() => {
swapButton();
}, 5);
}
clearTimeout(insertingTimeout);
insertingPlayers = true;
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 200);
setTimeout(() => {
topButton();
}, 200);
activateChooseMode();
} else if ([Link] == 6) {
resetButton();
clearTimeout(insertingTimeout);
insertingPlayers = true;
insertingTimeout = setTimeout(() => {
insertingPlayers = false;
}, 1500);
setTimeout(() => {
randomButton();
setTimeout(() => {
randomButton();
setTimeout(() => {
randomButton();
}, 500);
}, 500);
}, 500);
startTimeout = setTimeout(() => {
[Link]();
}, 2000);
}
}
}
}
/* STATS FUNCTIONS */
/* GK FUNCTIONS */
function handleGKTeam(team) {
if (team == [Link]) {
return null;
}
let teamArray = team == [Link] ? teamRed : teamBlue;
let playerGK = [Link]((prev, current) => {
if (team == [Link]) {
return (prev?.position.x < [Link].x) ? prev : current
} else {
return (prev?.position.x > [Link].x) ? prev : current
}
}, null);
let playerCompGK = getPlayerComp(playerGK);
return playerCompGK;
}
function handleGK() {
let redGK = handleGKTeam([Link]);
if (redGK != null) {
[Link]++;
}
let blueGK = handleGKTeam([Link]);
if (blueGK != null) {
[Link]++;
}
}
function getGK(team) {
if (team == [Link]) {
return null;
}
let teamArray = team == [Link] ? [Link][0] : [Link][1];
let playerGK = [Link]((prev, current) => {
return (prev?.GKTicks > [Link]) ? prev : current
}, null);
return playerGK;
}
function getCS(scores) {
let playersNameCS = [];
let redGK = getGK([Link]);
let blueGK = getGK([Link]);
if (redGK != null && [Link] == 0) {
[Link]([Link]);
}
if (blueGK != null && [Link] == 0) {
[Link]([Link]);
}
return playersNameCS;
}
function getCSString(scores) {
let playersCS = getCS(scores);
if ([Link] == 0) {
return "🥅 No CS.\n Recuerda estamos en pruebas \n Discord:
[Link]
} else if ([Link] == 1) {
return `🥅 ${playersCS[0]} Obtuvo una CS.\n Recuerda estamos en
pruebas \n Discord: [Link]
} else {
return `🥅 ${playersCS[0]} and ${playersCS[1]} Obtuvo una cs \n Recuerda
estamos en pruebas \n Discord: [Link]
}
}
function getLastTouchOfTheBall() {
const ballPosition = [Link]();
updateTeams();
let playerArray = [];
for (let player of players) {
if ([Link] != null) {
var distanceToBall = pointDistance([Link], ballPosition);
if (distanceToBall < triggerDistance) {
if (playSituation == [Link]) playSituation =
[Link];
[Link]([player, distanceToBall]);
}
}
}
if ([Link] != 0) {
let playerTouch = [Link]((a, b) => a[1] - b[1])[0][0];
if (lastTeamTouched == [Link] || lastTeamTouched ==
[Link]) {
if (lastTouches[0] == null || (lastTouches[0] != null &&
lastTouches[0].[Link] != [Link])) {
[Link](
new BallTouch(
playerTouch,
[Link],
getGoalGame(),
ballPosition
)
);
lastTouches[0] = checkGoalKickTouch(
[Link],
[Link] - 1,
getGoalGame()
);
lastTouches[1] = checkGoalKickTouch(
[Link],
[Link] - 2,
getGoalGame()
);
}
}
lastTeamTouched = [Link];
}
}
function getBallSpeed() {
var ballProp = [Link](0);
return [Link]([Link] ** 2 + [Link] ** 2) *
speedCoefficient;
}
function getGameStats() {
if (playSituation == [Link] && gameState == [Link]) {
lastTeamTouched == [Link] ? possession[0]++ : possession[1]++;
var ballPosition = [Link]();
ballPosition.x < 0 ? actionZoneHalf[0]++ : actionZoneHalf[1]++;
handleGK();
}
}
function getGoalAttribution(team) {
var goalAttribution = Array(2).fill(null);
if (lastTouches[0] != null) {
if (lastTouches[0].[Link] == team) {
// Direct goal scored by player
if (lastTouches[1] != null && lastTouches[1].[Link] == team) {
goalAttribution = [lastTouches[0].player,
lastTouches[1].player];
} else {
goalAttribution = [lastTouches[0].player, null];
}
} else {
// Own goal
goalAttribution = [lastTouches[0].player, null];
}
}
return goalAttribution;
}
function getGoalString(team) {
var goalString;
var scores = [Link];
var goalAttribution = getGoalAttribution(team);
if (goalAttribution[0] != null) {
if (goalAttribution[0].team == team) {
if (goalAttribution[1] != null && goalAttribution[1].team == team)
{
goalString = `⚽ ${getTimeGame([Link])} $
{frasesGols[[Link]([Link]() * [Link])]} De $
{goalAttribution[0].name} ${frasesAsiten[[Link]([Link]() *
[Link])]} ${goalAttribution[1].name}. Velocidad de entrada : $
{[Link](2)}km/h.`;
[Link](
new Goal(
[Link],
team,
goalAttribution[0],
goalAttribution[1]
)
);
} else {
goalString = `⚽ ${getTimeGame([Link])} $
{frasesGols[[Link]([Link]() * [Link])]} De $
{goalAttribution[0].name} ! Velocidad de entrada : ${[Link](2)}km/h.`;
[Link](
new Goal([Link], team, goalAttribution[0], null)
);
}
} else {
goalString = `😂 ${getTimeGame([Link])} $
{frasesOG[[Link]([Link]() * [Link])]} $
{goalAttribution[0].name} ! Velocidad de gol : ${[Link](2)}km/h.`;
[Link](
new Goal([Link], team, goalAttribution[0], null)
);
}
} else {
goalString = `⚽ ${getTimeGame([Link])} $
{frasesGols[[Link]([Link]() * [Link])]} Gol DEL ${team ==
[Link] ? 'Rojo' : 'Azul'} Equipo ! Velocidad de gol :
${[Link](2)}km/h.`;
[Link](
new Goal([Link], team, null, null)
);
}
return goalString;
}
function updateStats() {
if (
[Link] >= 2 * teamSize &&
(
[Link] >= (5 / 6) * [Link] ||
[Link] == [Link] ||
[Link] == [Link]
) &&
[Link] >= teamSize && [Link] >= teamSize
) {
for (let player of teamRedStats) {
updatePlayerStats(player, [Link]);
}
for (let player of teamBlueStats) {
updatePlayerStats(player, [Link]);
}
}
}
function printRankings(statKey, id = 0) {
var leaderboard = [];
statKey = statKey == "cs" ? "CS" : statKey;
for (var i = 0; i < [Link]; i++) {
var key = [Link](i);
if ([Link] == 43)
[Link]([
[Link]([Link](key)).playerName,
[Link]([Link](key))[statKey],
]);
}
if ([Link] < 5) {
if (id != 0) {
[Link](
'Todavía no se juegan suficientes juegos !',
id,
errorColor,
'bold',
[Link]
);
}
return;
}
[Link](function (a, b) { return b[1] - a[1]; });
var rankingString = `${[Link](0).toUpperCase() + [Link](1)}>
`;
for (let i = 0; i < 5; i++) {
let playerName = leaderboard[i][0];
let playerStat = leaderboard[i][1];
if (statKey == 'Tiempo jugado') playerStat = getTimeStats(playerStat);
rankingString += `#${i + 1} ${playerName} : ${playerStat}, `;
}
rankingString = [Link](0, [Link] - 2);
[Link](
rankingString,
id,
infoColor,
'bold',
[Link]
);
}
function getGamePlayerStats(player) {
var stats = new HaxStatistics([Link]);
var pComp = getPlayerComp(player);
[Link] += getGoalsPlayer(pComp);
[Link] += getAssistsPlayer(pComp);
[Link] += getOwnGoalsPlayer(pComp);
[Link] += getGametimePlayer(pComp);
[Link] += getCSPlayer(pComp);
return stats;
}
function getGametimePlayer(pComp) {
if (pComp == null) return 0;
var timePlayer = 0;
for (let j = 0; j < [Link]; j++) {
if ([Link] < j + 1) {
timePlayer += [Link] - [Link][j];
} else {
timePlayer += [Link][j] - [Link][j];
}
}
return [Link](timePlayer);
}
function getGoalsPlayer(pComp) {
if (pComp == null) return 0;
var goalPlayer = 0;
for (let goal of [Link]) {
if ([Link] != null && [Link] === [Link]) {
if (authArray[[Link]][0] == [Link]) {
goalPlayer++;
}
}
}
return goalPlayer;
}
function getOwnGoalsPlayer(pComp) {
if (pComp == null) return 0;
var goalPlayer = 0;
for (let goal of [Link]) {
if ([Link] != null && [Link] !== [Link]) {
if (authArray[[Link]][0] == [Link]) {
goalPlayer++;
}
}
}
return goalPlayer;
}
function getAssistsPlayer(pComp) {
if (pComp == null) return 0;
var assistPlayer = 0;
for (let goal of [Link]) {
if ([Link] != null) {
if (authArray[[Link]][0] == [Link]) {
assistPlayer++;
}
}
}
return assistPlayer;
}
function getGKPlayer(pComp) {
if (pComp == null) return 0;
let GKRed = getGK([Link]);
if ([Link] == GKRed?.auth) {
return [Link];
}
let GKBlue = getGK([Link]);
if ([Link] == GKBlue?.auth) {
return [Link];
}
return [Link];
}
function getCSPlayer(pComp) {
if (pComp == null || [Link] == null) return 0;
if (getGKPlayer(pComp) == [Link] && [Link] == 0) {
return 1;
} else if (getGKPlayer(pComp) == [Link] && [Link] == 0) {
return 1;
}
return 0;
}
/* PRINT FUNCTIONS */
function printPlayerStats(stats) {
let statsString = '';
for (let [key, value] of [Link](stats)) {
if (key == 'playerName') statsString += `${value}: `;
else {
if (key == 'Tiempo jugado') value = getTimeStats(value);
let reCamelCase = /([A-Z](?=[a-z]+)|[A-Z]+(?![a-z]))/g;
let statName = [Link](reCamelCase, ' $1').trim();
statsString += `${[Link](0).toUpperCase() +
[Link](1)}: ${value}, `;
}
}
statsString = [Link](0, [Link] - 2);
return statsString;
}
/* FETCH FUNCTIONS */
function fetchGametimeReport(game) {
var fieldGametimeRed = {
name: '🔴 **Estadísticas del equipo rojo**',
value: '⌛ __**Tiempo de juego:**__\n\n',
inline: true,
};
var fieldGametimeBlue = {
name: '🔵 **Estadísticas del equipo azul**',
value: '⌛ __**Tiempo de juego:**__\n\n',
inline: true,
};
var redTeamTimes = [Link][0].map((p) => [[Link],
getGametimePlayer(p)]);
var blueTeamTimes = [Link][1].map((p) => [[Link],
getGametimePlayer(p)]);
function fetchActionsSummaryReport(game) {
var fieldReportRed = {
name: '🔴 **Estadísticas del equipo rojo**',
value: '📊 __**Estadísticas de jugadores:**__\n\n',
inline: true,
};
var fieldReportBlue = {
name: '🔵 **Estadísticas del equipo azul**',
value: '📊 __**Estadísticas de jugadores:**__\n\n',
inline: true,
};
var goals = [[], []];
for (let i = 0; i < [Link]; i++) {
goals[[Link][i].team - 1].push([[Link][i].striker,
[Link][i].assist]);
}
var redActions = actionReportCountTeam(goals, [Link]);
if ([Link] > 0) {
for (let act of redActions) {
[Link] += `> **${act[0].team != [Link] ? '[OG] ' :
''}${act[0].name}:**` +
`${act[1] > 0 ? ` ${act[1]}G` : ''}` +
`${act[2] > 0 ? ` ${act[2]}A` : ''}` +
`${act[3] > 0 ? ` ${act[3]}CS` : ''}\n`;
}
}
var blueActions = actionReportCountTeam(goals, [Link]);
if ([Link] > 0) {
for (let act of blueActions) {
[Link] += `> **${act[0].team != [Link] ? '[OG]
' : ''}${act[0].name}:**` +
`${act[1] > 0 ? ` ${act[1]}G` : ''}` +
`${act[2] > 0 ? ` ${act[2]}A` : ''}` +
`${act[3] > 0 ? ` ${act[3]}CS` : ''}\n`;
}
}
function fetchSummaryEmbed(game) {
var fetchEndgame = [fetchGametimeReport, fetchActionsSummaryReport];
var logChannel = gameWebhook;
var fields = [
{
name: '🔴 **Estadísticas del equipo rojo**',
value: '=====================\n\n',
inline: true,
},
{
name: '🔵 **Estadísticas del equipo azul**',
value: '=====================\n\n',
inline: true,
},
];
for (let i = 0; i < [Link]; i++) {
var fieldsReport = fetchEndgame[i](game);
fields[0].value += fieldsReport[0].value + '\n\n';
fields[1].value += fieldsReport[1].value + '\n\n';
}
fields[0].value = fields[0].[Link](0, fields[0].[Link] - 2);
fields[1].value = fields[1].[Link](0, fields[1].[Link] - 2);
/* EVENTS */
/* PLAYER MOVEMENT */
|----------------------------------------------------------------------------------
-|
|
| |
| ██╗░░░██╗███████╗██╗░░██╗░█████╗░██╗░░██╗
|
| ██║░░░██║██╔════╝██║░░██║██╔══██╗╚██╗██╔╝
|
| ╚██╗░██╔╝█████╗░░███████║███████║░╚███╔╝░
|
| ░╚████╔╝░██╔══╝░░██╔══██║██╔══██║░██╔██╗░
|
| ░░╚██╔╝░░███████╗██║░░██║██║░░██║██╔╝╚██╗
|
| ░░░╚═╝░░░╚══════╝╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝
|
|----------------------------------------------------------------------------------
-|
!!🏆🥳🎉VEHAX🏆🥳🎉!!
// Evento de chat
[Link](player => {
// Verifica si el jugador está haciendo spam
if (isSpam(player)) {
// Expulsa al jugador
kickPlayer(player);
}
});
/* PLAYER ACTIVITY */
/* llamar admin */
/* Anuncios */
var announcements = [
'Recuerda tené buen comportamiento para no ser vetado de la sala ✅',
'Si tienes una sugerencia o encuentras un bug entra a nuestro \n Discord
con !discord y repórtalo! 📩',
'No olvides entrar a nuestro discord oficial! ✅ \n Usar !discord o usa este
enlace \n [Link]
'Si hay un problema en la sala usa !llamar para llamar un admin \n El mal
uso de este te puede causar un Warn 🔴',
'Puedes ver tu estadisticas usando el comando \n !Yo, !Me, \n Puedes ver
las estadisticas globales con \n !games, !wins, !goals, !assists, !cs, !playtime',
'Las inscripciones para la Temporada 3 esta abiertas! 😎 \n
[Link]
'Si tu estadísticas se perdieron es posible que hubo una actualización \n
Por ahora no tenemos un sistema para guardar tus estadísticas 😞 \n Si deseas
ayudar como editor de código o programador entra a nuestro !Discord 😀'
];
var currentAnnouncement = 0;
setInterval(() => {
currentAnnouncement = [Link]([Link]() * [Link]);
[Link](
announcements[currentAnnouncement],
null,
anunciosColor,
'bold',
[Link]
);
}, 60000);
/* Slots privados */
// Establecer la contraseña
[Link]((player) => {
// Obtener el número actual de jugadores en la sala
const numPlayers = [Link]().length;
[Link](
"La sala llego a su maximo, Se coloco contraseña",
null,
anunciosColor,
"bold",
[Link]
);
}
});
// Quitar la contraseña
[Link]((player) => {
// Obtener el número actual de jugadores en la sala
const numPlayers = [Link]().length;
[Link](
"La contraseña ha sido quitada, la sala esta abierta a todos",
null,
anunciosColor,
"bold",
[Link]
);
}
});
/* GAME MANAGEMENT */
[Link] = function () {
lastTouches = Array(2).fill(null);
lastTeamTouched = [Link];
playSituation = [Link];
};
/* MISCELLANEOUS */
[Link] = function () {
checkTime();
getLastTouchOfTheBall();
getGameStats();
handleActivity();
}