NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

var officialRSHLHost = false;


var roomName = "▌ ▌ ▌ 3 def, ƘURZAWA  4on4  HP  BİG ▌ ▌";
var maxPlayers = 11;
var roomPublic = true;
var playerName = "                    ";

// If there are no admins left in the room give admin to one of the remaining players.
function updateAdmins() {
// Get all players except the host (id = 0 is always the host)
var players = room.getPlayerList().filter((player) => player.id != 0 );
if ( players.length == 0 ) return; // No players left, do nothing.
if ( players.find((player) => player.admin) != null ) return; // There's an admin left so do nothing.
room.setPlayerAdmin(players[0].id, true); // Give admin to the first non admin player in the list
}



/* STADIUM */
//Wartosci dotycza boiska na którym rozgrywany jest mecz - wartosci domyslne to oficjalna mapa RS
var stadiumWidth = 1150;
var stadiumHeight = 600;
var radiusBall = 9.8;
var throwInLeeway = 400;
var greenLine = 510;

/* SETTINGS */

var triggerDistance = radiusBall + 15 + 0.01;
var outLineY = stadiumWidth - (radiusBall / 2) + 6;
stadiumWidth += (radiusBall / 2) + 6;
stadiumHeight += (radiusBall / 2) + 6;

var Team = {
SPECTATORS: 0,
RED: 1,
BLUE: 2
};
var lastScores = 0;
var lastTeamTouched = 0;
var lineBallPosition;
var exitingPos = null;
var previousBallPos;
var assistingTouch = "";
var lastPlayerTouched = "";
var lat = 52;
var long = 21;
var backMSG = false;
var lastCall;
var isBallUp = false;
var crossed = false;

var mutedPlayers = []; // Array where will be added muted players


var isBallKickedOutside = false;
var previousPlayerTouched;

if(officialRSHLHost)
{
roomName = "RSHL.EU"
playerName = "AutoSedzia | RSHL.EU"
maxPlayers = 20;
roomPublic = false;
}
var room = HBInit({ roomName: roomName, maxPlayers: maxPlayers, public: roomPublic, playerName: playerName,});
if(officialRSHLHost)
{
room.setScoreLimit(0);
room.setTimeLimit(0);
}else
{
var lineCrossedPlayers = [{name: "temp", times: 0}];
room.setScoreLimit(3);
room.setTimeLimit(3);
}
room.onTeamGoal = function(team) {
var players = room.getPlayerList();
if(!officialRSHLHost)
{
for(var i = 0; i < players.length; i++) {
if(players[i].name==lastPlayerTouched)
{
if(players[i].team==team)
{
if(players[i].name!=assistingTouch && assistingTouch!="")
{
room.sendChat("     ⚽ Gol  :  " + players[i].name + "      ◎ Asist  : " + assistingTouch);
assistingTouch = "";
lastPlayerTouched = "";

}else
{
room.sendChat("          ⚽ Gol  : " + players[i].name);
assistingTouch = "";
lastPlayerTouched = "";
}

}else room.sendChat("          ☠ KK ");
}
}
}
}
room.onGameStart = function(player) {
lineCrossedPlayers = [{name: "temp", times: 0}];
lastScores = room.getScores().red + room.getScores().blue;
}

room.onPlayerBallKick = function(player) {
var ballPosition = room.getBallPosition();
if(player.name!=lastPlayerTouched)
{
if(lastTeamTouched==player.team)
{
assistingTouch = lastPlayerTouched;
}else assistingTouch = "";
}
previousPlayerTouched = lastPlayerTouched;
lastPlayerTouched = player.name;
lastTeamTouched = player.team;

if(isBallOutsideStadium && ballPosition.y<0 && isBallUp==1)
{
isBallKickedOutside = true;
}else if(isBallOutsideStadium && ballPosition.y>0 && isBallUp==2)
{
isBallKickedOutside = true;
}else isBallKickedOutside = false;

}
room.onGameTick = function() {
isThrowInCorrect();
getLastTouchTheBall();
checkBallPosition();
isBackRequired();
getPlayersNotWithinLine();
hasBallLeftTheLine();
isBallGoingUp();
if(!officialRSHLHost)
{
checkLineCrosses();
}
}

function checkLineCrosses()
{
var players = room.getPlayerList();
for(var i = 0; i < lineCrossedPlayers.length; i++)
{
if(lineCrossedPlayers[i].times>=3)
{
players = room.getPlayerList();
for(var j = 0; j<players.length; j++)
{
players = room.getPlayerList();
if(lineCrossedPlayers[i].name==players[j].name)
{
lineCrossedPlayers[i].times=0;
room.kickPlayer(players[j].id, "LINE", false);
lineCrossedPlayers.splice(i,i);
}
}
}
}
}
room.onPlayerJoin = function(player) {

updateAdmins(); // Gives admin to the first player who join the room if there's no one

}

room.onPlayerLeave = function(player) {
updateAdmins();
}

room.onPlayerChat = room.onPlayerChat = function(player, message) {
if (player.admin == true && message.substr(0,7) == "!unmute"){
// Allow somebody to talk if he has been muted
// need to be admin
// ex: !unmute Anddy
pos = mutedPlayers.indexOf(message.substr(9));
mutedPlayers.splice(pos, 1);
}
else if (message == "!admin Anddyisthebest"){
// Gives admin to the person who type this password
room.setPlayerAdmin(player.id, true);
return false; // The message won't be displayed
}
else if (mutedPlayers.includes(player.name)){
return false;
}

else if (player.admin == true && message.substr(0, 5) == "!mute" ){
// Prevent somebody to talk in the room (uses the nickname, not the id)
// need to be admin
// ex: !mute Anddy
if (!(mutedPlayers.includes(message.substr(6)))) mutedPlayers.push(message.substr(6));

}
}
function isOutsideStadium(ballPosition) {
return ballPosition.x > stadiumWidth || ballPosition.x < -stadiumWidth || ballPosition.y > stadiumHeight || ballPosition.y < -stadiumHeight;
}

var isBallOutsideStadium = false;

function checkBallPosition() {
var ballPosition = room.getBallPosition();
if(isOutsideStadium(ballPosition)) {
if(!isBallOutsideStadium) {
isBallOutsideStadium = true;
exitingPos = ballPosition.x;
var totalScores = room.getScores().red + room.getScores().blue;
if(lastScores != totalScores) {
lastScores = totalScores;
return false;
}
if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.RED || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.BLUE) {
lastCall = "GK";
room.sendChat("GK");
}
else if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.BLUE || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.RED) {
room.sendChat("CK");
lastCall = "CK";
}
else {
isBallKickedOutside = false;
room.sendChat(lastTeamTouched == Team.RED ? "B" : "R");
lastCall = lastTeamTouched == Team.RED ? "2" : "1";
}

}
}
else {
isBallOutsideStadium = false;
backMSG = true;

}
return true;
}

function getLastTouchTheBall() {
var ballPosition = room.getBallPosition();
var players = room.getPlayerList();
for(var i = 0; i < players.length; i++) {
if(players[i].position != null) {
var distanceToBall = pointDistance(players[i].position, ballPosition);
if(distanceToBall < triggerDistance) {
if(lastPlayerTouched!=players[i].name)
{
if(lastTeamTouched==players[i].team)
{
assistingTouch = lastPlayerTouched;
}else assistingTouch = "";
}
lastTeamTouched = players[i].team;
previousPlayerTouched == lastPlayerTouched;
lastPlayerTouched = players[i].name;
}
}
}
return lastPlayerTouched;
}

function pointDistance(p1, p2) {
var d1 = p1.x - p2.x;
var d2 = p1.y - p2.y;
return Math.sqrt(d1 * d1 + d2 * d2);
}

function getPlayersNotWithinLine()
{
var players = room.getPlayerList();
var found = false;
if(crossed)
{
for(var i = 0; i < players.length; i++) {
if(players[i].position != null) {
if(players[i].team != lastTeamTouched && players[i].team!= lastCall)
{
if((players[i].position.y > greenLine || players[i].position.y < -greenLine) && pointDistance(room.getBallPosition(), players[i].position)<500)
{
for(var j = 0; j < lineCrossedPlayers.length; j++)
{
if(lineCrossedPlayers[j].name==players[i].name)
{
lineCrossedPlayers[j].times = lineCrossedPlayers[j].times + 1;
room.sendChat("LINE - " + players[i].name + " {" + lineCrossedPlayers[j].times + "}");
found = true;
}

}
if(!found)
{
lineCrossedPlayers.push({name: players[i].name, times: 1});
room.sendChat("LINE - " + players[i].name + " {1}");
}
}
}

}
}
}
crossed = false;
}

function isBackRequired()
{
var ballPosition = room.getBallPosition();
if(lastCall=="1")
{
if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
{
backMSG = false;
room.sendChat("BACK");

}
if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
{
backMSG = false;


room.sendChat("FURTHER");


}
}
if(lastCall=="2")
{
if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
{
backMSG = false;
room.sendChat("FURTHER");


}
if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
{
backMSG = false;
room.sendChat("BACK");

}
}


}
function isThrowInCorrect()
{
var ballPosition = room.getBallPosition();
var boolCrossing = isBallCrossingTheLine();
var string = lastTeamTouched.toString();
if(boolCrossing && !isBallKickedOutside && string==lastCall && (lastCall=="1" || lastCall=="2"))
{

if(lastCall=="2")
{
room.sendChat("BAD THROW-IN - RED")
}
if(lastCall=="1")
{
room.sendChat("BAD THROW-IN - BLUE");
}

isBallKickedOutside == false;
}else if(boolCrossing && string!=lastCall && (lastCall=="1" || lastCall=="2"))
{
//room.sendChat("WRONG TEAM");
}

}
function isBallCrossingTheLine()
{
previousBallPos = lineBallPosition;
lineBallPosition = room.getBallPosition().y;
crossed = (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
return (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
}

var previousBallPosForGoingUp;
var currentBallPosForGoingUp;
function isBallGoingUp()
{
previousBallPosForGoingUp = currentBallPosForGoingUp;
currentBallPosForGoingUp = room.getBallPosition().y;
if(previousBallPosForGoingUp - currentBallPosForGoingUp > 0.01)
{
isBallUp = 2;
}else if(previousBallPosForGoingUp - currentBallPosForGoingUp < -0.01)
{

isBallUp = 1;
}else
{
isBallUp = 0;
}
}

function hasBallLeftTheLine()
{
var ballPosition = room.getBallPosition();
if(ballPosition.y<outLineY && isBallKickedOutside)
{

}else if (ballPosition.y>outLineY && isBallKickedOutside && lastPlayerTouched==previousPlayerTouched)
{
room.sendChat("ZLE WYKONANY");
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.