Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SETTINGS */
- var salaoficial = false;
- /* ROOM */
- var roomName = "Alpha.|Real Soccer 4V4 HEHE ";
- var maxPlayers = 12;
- var roomPublic =true;
- var cntposred = 0;
- var cntposblue = 0;
- var cntallpos = 0;
- var playerName = "AlphaBot";
- var real = '{"name" : "WeAreHaxball | RF V2.0","width" : 1300,"height" : 670,"spawnDistance" : 500,"bg" : { "type" : "grass", "width" : 1150, "height" : 600, "kickOffRadius" : 180, "cornerRadius" : 0 },"playerPhysics" : {"bCoef" : 0.5,"invMass" : 0.5,"damping" : 0.96,"acceleration" : 0.12,"kickingAcceleration" : 0.07,"kickingDamping" : 0.96,"kickStrength" : 5.65 },"vertexes" : [{"x" : 0,"y" : 700,"trait" : "kickOffBarrier" },{"x" : 0,"y" : 180,"trait" : "kickOffBarrier" },{"x" : 0,"y" : -180,"trait" : "kickOffBarrier" },{"x" : 0,"y" : -700,"trait" : "kickOffBarrier" },{"x" : 1150,"y" : 255,"trait" : "line" },{"x" : 840,"y" : 255,"trait" : "line" },{"x" : 1150,"y" : -255,"trait" : "line" },{"x" : 840,"y" : -255,"trait" : "line" },{"x" : 1150,"y" : 155,"trait" : "line" },{"x" : 1030,"y" : 155,"trait" : "line" },{"x" : 1150,"y" : -155,"trait" : "line" },{"x" : 1030,"y" : -155,"trait" : "line" },{"x" : 840,"y" : -135,"trait" : "line","curve" : -130 },{"x" : 840,"y" : 135,"trait" : "line","curve" : -130 },{"x" : -1150,"y" : -255,"trait" : "line","curve" : -90,"color" : "97AC86" },{"x" : -840,"y" : -255,"trait" : "line" },{"x" : -1150,"y" : 255,"trait" : "line" },{"x" : -840,"y" : 255,"trait" : "line" },{"x" : -1150,"y" : -155,"trait" : "line" },{"x" : -1030,"y" : -155,"trait" : "line" },{"x" : -1150,"y" : 155,"trait" : "line" },{"x" : -1030,"y" : 155,"trait" : "line" },{"x" : -840,"y" : 135,"trait" : "line","curve" : -130 },{"x" : -840,"y" : -135,"trait" : "line","curve" : -130 },{"x" : 935,"y" : 4,"trait" : "line" },{"x" : 935,"y" : -4,"trait" : "line" },{"x" : -935,"y" : 4,"trait" : "line" },{"x" : -935,"y" : -4,"trait" : "line" },{"x" : -1150,"y" : 575,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : -1125,"y" : 600,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : -1125,"y" : -600,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : -1150,"y" : -575,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : 1125,"y" : 600,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : 1150,"y" : 575,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : 1150,"y" : -575,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : 1125,"y" : -600,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"x" : -1150,"y" : 127,"trait" : "line","color" : "ffffff" },{"x" : -1210,"y" : 124,"trait" : "line","color" : "ffffff","curve" : 5 },{"x" : -1150,"y" : -127,"trait" : "line","color" : "ffffff" },{"x" : -1210,"y" : -124,"trait" : "line","color" : "ffffff","curve" : 5 },{"x" : 1150,"y" : 127,"trait" : "line","color" : "ffffff" },{"x" : 1210,"y" : 124,"trait" : "line","color" : "ffffff","curve" : -5 },{"x" : 1150,"y" : -127,"trait" : "line","color" : "ffffff" },{"x" : 1210,"y" : -124,"trait" : "line","color" : "ffffff","curve" : -5 },{"x" : 0,"y" : -4,"trait" : "line" },{"x" : 0,"y" : 4,"trait" : "line" },{"x" : 0,"y" : -4,"trait" : "line" },{"x" : 0,"y" : 4,"trait" : "line" },{"x" : -1210,"y" : 124,"trait" : "line","color" : "ffffff" },{"x" : -1250,"y" : 150,"trait" : "line","color" : "ffffff","pos" : [-1250,150] },{"x" : -1210,"y" : -124,"trait" : "line","color" : "ffffff","_selected" : true },{"x" : -1250,"y" : -150,"trait" : "line","color" : "ffffff","pos" : [-1250,-150] },{"x" : 1210,"y" : 124,"trait" : "line","color" : "ffffff" },{"x" : 1250,"y" : 150,"trait" : "line","color" : "ffffff" },{"x" : 1210,"y" : -124,"trait" : "line","color" : "ffffff" },{"x" : 1250,"y" : -150,"trait" : "line","color" : "ffffff" },{"x" : -1185,"y" : 155,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : 40,"color" : "BEB86C" },{"x" : -1185,"y" : 255,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : 40,"color" : "BEB86C" },{"x" : 1185,"y" : 155,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : -40,"color" : "BEB86C" },{"x" : 1185,"y" : 255,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : -40,"color" : "BEB86C" },{"x" : -1185,"y" : -155,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : -40,"color" : "BEB86C" },{"x" : -1185,"y" : -255,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : -40,"color" : "BEB86C" },{"x" : 1185,"y" : -155,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : 40,"color" : "BEB86C" },{"x" : 1185,"y" : -255,"bCoef" : -4.5,"cMask" : ["ball"],"trait" : "line","curve" : 40,"color" : "BEB86C" },{"x" : 1158,"y" : -607,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : 0,"color" : "BEB86C" },{"x" : 1187,"y" : -578,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : -60,"color" : "BEB86C" },{"x" : 1158,"y" : 607,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : 0,"color" : "BEB86C" },{"x" : 1187,"y" : 578,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : 60,"color" : "BEB86C" },{"x" : -1158,"y" : 607,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : 0,"color" : "BEB86C" },{"x" : -1187,"y" : 578,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : -60,"color" : "BEB86C" },{"x" : -1158,"y" : -607,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : 0,"color" : "BEB86C" },{"x" : -1187,"y" : -578,"bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line","curve" : 60,"color" : "BEB86C" },{"x" : -1190,"y" : -255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1180,"y" : -255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1190,"y" : -155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1180,"y" : -155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1190,"y" : 155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1180,"y" : 155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1190,"y" : 255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1180,"y" : 255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1190,"y" : -255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1180,"y" : -255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1190,"y" : -155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1180,"y" : -155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1190,"y" : 255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1180,"y" : 255,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1190,"y" : 155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : 1180,"y" : 155,"bCoef" : -1,"cMask" : ["ball"],"trait" : "line","color" : "000000","curve" : 0 },{"x" : -1148,"y" : -525,"trait" : "line","curve" : -90,"color" : "5E844D" },{"x" : 1148,"y" : -525,"trait" : "line","color" : "5E844D" },{"x" : -1148,"y" : 525,"trait" : "line","curve" : -90,"color" : "5E844D" },{"x" : 1148,"y" : 525,"trait" : "line","color" : "5E844D" },{"x" : -1150,"y" : -260,"trait" : "line","curve" : -100,"color" : "5E844D" },{"x" : -840,"y" : -600,"trait" : "line","color" : "5E844D","curve" : -100 },{"x" : -1150,"y" : 260,"trait" : "line","curve" : 100,"color" : "5E844D" },{"x" : -840,"y" : 600,"trait" : "line","color" : "5E844D","curve" : 100 },{"x" : -840,"y" : -1150,"trait" : "line","color" : "5E844D","curve" : -100 },{"x" : 1150,"y" : -260,"trait" : "line","curve" : 100,"color" : "5E844D" },{"x" : 840,"y" : -600,"trait" : "line","color" : "5E844D","curve" : 100 },{"x" : 1150,"y" : 260,"trait" : "line","curve" : -100,"color" : "5E844D" },{"x" : 840,"y" : 600,"trait" : "line","color" : "5E844D","curve" : -100 }],"segments" : [{"v0" : 37,"v1" : 39,"curve" : 5,"color" : "ffffff","trait" : "reargoalNetleft","x" : -1210 },{"v0" : 41,"v1" : 43,"curve" : -5,"color" : "ffffff","trait" : "reargoalNetright" },{"v0" : 4,"v1" : 5,"trait" : "line","y" : 250 },{"v0" : 5,"v1" : 7,"trait" : "line","x" : 840 },{"v0" : 6,"v1" : 7,"trait" : "line","y" : -250 },{"v0" : 8,"v1" : 9,"trait" : "line","y" : 150 },{"v0" : 9,"v1" : 11,"trait" : "line","x" : 1030 },{"v0" : 10,"v1" : 11,"trait" : "line","y" : -150 },{"v0" : 12,"v1" : 13,"curve" : -130,"trait" : "line","x" : 840 },{"v0" : 14,"v1" : 15,"trait" : "line","y" : -250 },{"v0" : 15,"v1" : 17,"trait" : "line","x" : -840 },{"v0" : 16,"v1" : 17,"trait" : "line","y" : 250 },{"v0" : 18,"v1" : 19,"trait" : "line","y" : -150 },{"v0" : 19,"v1" : 21,"trait" : "line","x" : -1030 },{"v0" : 20,"v1" : 21,"trait" : "line","y" : 150 },{"v0" : 22,"v1" : 23,"curve" : -130,"trait" : "line","x" : -840 },{"v0" : 24,"v1" : 25,"curve" : -180,"trait" : "line","x" : 935 },{"v0" : 26,"v1" : 27,"curve" : -180,"trait" : "line","x" : -935 },{"v0" : 24,"v1" : 25,"curve" : 180,"trait" : "line","x" : 935 },{"v0" : 26,"v1" : 27,"curve" : 180,"trait" : "line","x" : -935 },{"v0" : 24,"v1" : 25,"curve" : 90,"trait" : "line","x" : 935 },{"v0" : 26,"v1" : 27,"curve" : 90,"trait" : "line","x" : -935 },{"v0" : 24,"v1" : 25,"curve" : -90,"trait" : "line","x" : 935 },{"v0" : 26,"v1" : 27,"curve" : -90,"trait" : "line","x" : -935 },{"v0" : 24,"v1" : 25,"trait" : "line","x" : 935 },{"v0" : 26,"v1" : 27,"trait" : "line","x" : -935 },{"v0" : 28,"v1" : 29,"curve" : 90,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"v0" : 30,"v1" : 31,"curve" : 90,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"v0" : 32,"v1" : 33,"curve" : 90,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"v0" : 34,"v1" : 35,"curve" : 90,"bCoef" : 0,"cMask" : ["wall"],"trait" : "line" },{"v0" : 36,"v1" : 37,"curve" : 5,"color" : "ffffff","trait" : "sidegoalNet" },{"v0" : 38,"v1" : 39,"curve" : -5,"color" : "ffffff","trait" : "sidegoalNet" },{"v0" : 40,"v1" : 41,"curve" : -5,"color" : "ffffff","trait" : "sidegoalNet" },{"v0" : 42,"v1" : 43,"curve" : 5,"color" : "ffffff","trait" : "sidegoalNet" },{"v0" : 44,"v1" : 45,"curve" : -180,"trait" : "line" },{"v0" : 46,"v1" : 47,"curve" : 180,"trait" : "line" },{"v0" : 44,"v1" : 45,"curve" : -90,"trait" : "line" },{"v0" : 46,"v1" : 47,"curve" : 90,"trait" : "line" },{"v0" : 48,"v1" : 49,"color" : "ffffff","trait" : "line" },{"v0" : 50,"v1" : 51,"color" : "ffffff","trait" : "line" },{"v0" : 52,"v1" : 53,"color" : "ffffff","trait" : "line" },{"v0" : 54,"v1" : 55,"color" : "ffffff","trait" : "line" },{"v0" : 56,"v1" : 57,"curve" : 40,"vis" : true,"color" : "BEB86C","bCoef" : -4.7,"cMask" : ["ball"],"trait" : "line","x" : -1220 },{"v0" : 58,"v1" : 59,"curve" : -40,"vis" : true,"color" : "BEB86C","bCoef" : -4.7,"cMask" : ["ball"],"trait" : "line","x" : 1220 },{"v0" : 60,"v1" : 61,"curve" : -40,"vis" : true,"color" : "BEB86C","bCoef" : -4.7,"cMask" : ["ball"],"trait" : "line","x" : -1220 },{"v0" : 62,"v1" : 63,"curve" : 40,"vis" : true,"color" : "BEB86C","bCoef" : -4.7,"cMask" : ["ball"],"trait" : "line","x" : 1220 },{"v0" : 64,"v1" : 65,"curve" : -60,"vis" : true,"color" : "BEB86C","bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line" },{"v0" : 66,"v1" : 67,"curve" : 60,"vis" : true,"color" : "BEB86C","bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line" },{"v0" : 68,"v1" : 69,"curve" : -60,"vis" : true,"color" : "BEB86C","bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line" },{"v0" : 70,"v1" : 71,"curve" : 60,"vis" : true,"color" : "BEB86C","bCoef" : -2.45,"cMask" : ["ball"],"trait" : "line" },{"v0" : 0,"v1" : 1,"trait" : "kickOffBarrier" },{"v0" : 1,"v1" : 2,"curve" : 180,"cGroup" : ["blueKO"],"trait" : "kickOffBarrier" },{"v0" : 1,"v1" : 2,"curve" : -180,"cGroup" : ["redKO"],"trait" : "kickOffBarrier" },{"v0" : 2,"v1" : 3,"trait" : "kickOffBarrier" },{"v0" : 72,"v1" : 73,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 74,"v1" : 75,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 76,"v1" : 77,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 78,"v1" : 79,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 80,"v1" : 81,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 82,"v1" : 83,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 84,"v1" : 85,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 86,"v1" : 87,"curve" : 0,"vis" : true,"color" : "000000","bCoef" : -1,"cMask" : ["ball"],"trait" : "line" },{"v0" : 88,"v1" : 89,"color" : "5E844D","trait" : "line","y" : -475 },{"v0" : 90,"v1" : 91,"color" : "5E844D","trait" : "line","y" : -475 },{"v0" : 92,"v1" : 93,"curve" : -100,"color" : "5E844D","trait" : "line","y" : -475 },{"v0" : 94,"v1" : 95,"curve" : 100,"color" : "5E844D","trait" : "line","y" : -475 },{"v0" : 97,"v1" : 98,"curve" : 100,"color" : "5E844D","trait" : "line","y" : -475 },{"v0" : 99,"v1" : 100,"curve" : -100,"color" : "5E844D","trait" : "line","y" : -475 }],"goals" : [{"p0" : [-1160,-124],"p1" : [-1160,124],"team" : "red" },{"p0" : [1160,124],"p1" : [1160,-124],"team" : "blue" }],"discs" : [{"pos" : [-1150,127],"color" : "FF0000","bCoef" : 0.5,"trait" : "goalPost" },{"pos" : [-1150,-127],"color" : "FF0000","bCoef" : 0.5,"trait" : "goalPost" },{"pos" : [1150,127],"color" : "0000FF","bCoef" : 0.5,"trait" : "goalPost" },{"pos" : [1150,-127],"color" : "0000FF","bCoef" : 0.5,"trait" : "goalPost" },{"pos" : [-1250,150],"color" : "FF0000","trait" : "stanchion" },{"pos" : [-1250,-150],"color" : "FF0000","trait" : "stanchion" },{"pos" : [1250,150],"color" : "0000FF","trait" : "stanchion","x" : 1250 },{"pos" : [1250,-150],"color" : "0000FF","trait" : "stanchion","x" : 1250 },{"radius" : 2,"invMass" : 0,"pos" : [-1150,-600],"color" : "FFFFFF","bCoef" : -0.1,"cMask" : ["ball"],"trait" : "goalPost" },{"radius" : 2,"invMass" : 0,"pos" : [-1150,600],"color" : "FFFFFF","bCoef" : -0.1,"cMask" : ["ball"],"trait" : "goalPost" },{"radius" : 2,"invMass" : 0,"pos" : [1150,-600],"color" : "FFFFFF","bCoef" : -0.1,"cMask" : ["ball"],"trait" : "goalPost" },{"radius" : 2,"invMass" : 0,"pos" : [1150,600],"color" : "FFFFFF","bCoef" : -0.1,"cMask" : ["ball"],"trait" : "goalPost" }],"planes" : [{"normal" : [0,1],"dist" : -635,"bCoef" : 0,"trait" : "ballArea" },{"normal" : [0,-1],"dist" : -635,"bCoef" : 0,"trait" : "ballArea" },{"normal" : [0,1],"dist" : -670,"bCoef" : 0 },{"normal" : [0,-1],"dist" : -670,"bCoef" : 0 },{"normal" : [1,0],"dist" : -1300,"bCoef" : 0 },{"normal" : [-1,0],"dist" : -1300,"bCoef" : 0.1 },{"normal" : [1,0],"dist" : -1220,"bCoef" : 0,"cMask" : ["ball"] },{"normal" : [-1,0],"dist" : -1220,"bCoef" : 0,"cMask" : ["ball"] }],"traits" : {"ballArea" : {"vis" : false,"bCoef" : 0,"cMask" : ["ball"] },"goalPost" : {"radius" : 5,"invMass" : 0,"bCoef" : 2 },"stanchion" : {"radius" : 3,"invMass" : 0,"bCoef" : 3,"cMask" : ["none"] },"cornerflag" : {"radius" : 3,"invMass" : 0,"bCoef" : 0.5,"color" : "FFFF00","cGroup" : [] },"reargoalNetleft" : {"vis" : true,"bCoef" : 0.1,"cMask" : ["ball","red","blue"],"curve" : 10,"color" : "C7E6BD" },"reargoalNetright" : {"vis" : true,"bCoef" : 0.1,"cMask" : ["ball","red","blue"],"curve" : -10,"color" : "C7E6BD" },"sidegoalNet" : {"vis" : true,"bCoef" : 1,"cMask" : ["ball","red","blue"],"color" : "C7E6BD" },"kickOffBarrier" : {"vis" : false,"bCoef" : 0.1,"cGroup" : ["redKO","blueKO"],"cMask" : ["red","blue"] },"line" : {"vis" : true,"cMask" : [],"color" : "C7E6BD" },"tunnel" : {"vis" : true,"cMask" : ["red","blue"],"color" : "000000" },"advertising" : {"vis" : true,"cMask" : ["red","blue"],"color" : "333333" },"teambench" : {"vis" : true,"cMask" : [],"color" : "000000" },"manager" : {"radius" : 15,"vis" : true,"cMask" : ["red","blue"],"invMass" : 0,"color" : "333333" },"physio" : {"radius" : 15,"vis" : true,"cMask" : ["red","blue"],"invMass" : 0,"color" : "666666" },"redsubs" : {"radius" : 15,"vis" : true,"cMask" : ["red","blue"],"invMass" : 0,"color" : "E56E56" },"bluesubs" : {"radius" : 15,"vis" : true,"cMask" : ["red","blue"],"invMass" : 0,"color" : "5689E5" } },"ballPhysics" : {"invMass" : 1.05,"radius" : 9.8 } }'
- var pen = '{"name":"Penalty 1.1 Mod from HaxMaps","width":420,"height":200,"spawnDistance":300,"bg":{"type":"grass","width":500,"height":250,"kickOffRadius":10,"cornerRadius":0},"vertexes":[{"x":420,"y":600,"trait":"ballArea"},{"x":420,"y":-600,"trait":"ballArea"},{"x":283,"y":500,"trait":"gkArea"},{"x":283,"y":-500,"trait":"gkArea"},{"x":335,"y":500,"trait":"gkArea"},{"x":335,"y":-500,"trait":"gkArea"},{"x":-475,"y":-200,"trait":"penArea"},{"x":-10,"y":-190,"trait":"penArea"},{"x":-10,"y":190,"trait":"penArea"},{"x":-475,"y":200,"trait":"penArea"},{"x":300,"y":-250,"trait":"line"},{"x":300,"y":250,"trait":"line"},{"x":0,"y":9,"trait":"line"},{"x":0,"y":-9,"trait":"line"},{"x":0,"y":9,"trait":"line"},{"x":0,"y":-9,"trait":"line"},{"x":175,"y":-175,"trait":"line"},{"x":300,"y":-175,"trait":"line"},{"x":175,"y":175,"trait":"line"},{"x":300,"y":175,"trait":"line"},{"x":-120,"y":-250,"trait":"line"},{"x":-120,"y":250,"trait":"line"},{"x":-120,"y":-190,"trait":"line"},{"x":-120,"y":190,"trait":"line"},{"x":300,"y":-100,"trait":"line"},{"x":350,"y":-98,"trait":"line"},{"x":350,"y":98,"trait":"line"},{"x":300,"y":100,"trait":"line"},{"x":0,"y":-15,"trait":"powerboost"},{"x":0,"y":15,"trait":"powerboost"},{"x":400,"y":-135,"trait":"line"},{"x":400,"y":135,"trait":"line"}],"segments":[{"v0":0,"v1":1,"trait":"ballArea"},{"v0":2,"v1":3,"trait":"gkArea"},{"v0":4,"v1":5,"trait":"gkArea"},{"v0":6,"v1":7,"trait":"penArea"},{"v0":7,"v1":8,"trait":"penArea","curve":50},{"v0":8,"v1":9,"trait":"penArea"},{"v0":9,"v1":6,"trait":"penArea"},{"v0":10,"v1":11,"trait":"line"},{"v0":12,"v1":13,"trait":"line","curve":-180},{"v0":14,"v1":15,"trait":"line","curve":180},{"v0":16,"v1":17,"trait":"line"},{"v0":16,"v1":18,"trait":"line"},{"v0":18,"v1":19,"trait":"line"},{"v0":20,"v1":21,"trait":"line"},{"v0":22,"v1":23,"trait":"line","curve":-140},{"v0":24,"v1":25,"trait":"goalnet","curve":10},{"v0":25,"v1":26,"trait":"goalnet","curve":10},{"v0":26,"v1":27,"trait":"goalnet","curve":10},{"v0":28,"v1":29,"trait":"powerboost","curve":180},{"v0":25,"v1":30,"trait":"line"},{"v0":26,"v1":31,"trait":"line"}],"goals":[{"p0":[310,100],"p1":[310,-100],"team":"blue"},{"p0":[300,100],"p1":[-400,100],"team":"red"},{"p0":[300,-100],"p1":[-400,-100],"team":"red"},{"p0":[-10,250],"p1":[-10,-250],"team":"red"}],"discs":[{"pos":[300,100],"trait":"goalPost"},{"pos":[300,-100],"trait":"goalPost"},{"pos":[400,-135],"trait":"stanchion"},{"pos":[400,135],"trait":"stanchion"}],"planes":[{"normal":[0,1],"dist":-200,"trait":"ballArea"},{"normal":[0,-1],"dist":-200,"trait":"ballArea"},{"normal":[0,1],"dist":-250,"bCoef":0.1},{"normal":[0,-1],"dist":-250,"bCoef":0.1},{"normal":[1,0],"dist":-400,"bCoef":0.1},{"normal":[-1,0],"dist":-400,"bCoef":0.1}],"traits":{"ballArea":{"vis":false,"bCoef":1,"cMask":["ball"]},"gkArea":{"vis":false,"bCoef":0,"cMask":["blue"]},"penArea":{"vis":false,"bCoef":0,"cMask":["red"]},"line":{"vis":true,"color":"C7E6BD","cMask":[]},"goalnet":{"vis":true,"bCoef":0.1,"color":"C7E6BD","cMask":["ball","red","blue"]},"powerboost":{"vis":false,"bCoef":-2.4,"cMask":["ball"],"color":"C7E6BD"},"goalPost":{"radius":5,"invMass":0,"bCoef":1.3,"color":"FFFFFF"},"stanchion":{"radius":3,"invMass":0,"bCoef":1,"color":"FFFFFF"}}}'
- /* STADIUM */
- 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 isBallKickedOutside = false;
- var previousPlayerTouched;
- if(salaoficial)
- {
- roomName = "REAL SOCCER"
- playerName = "?RBITRO"
- maxPlayers = 20;
- roomPublic = false;
- }
- var room = HBInit({ roomName: roomName, maxPlayers: maxPlayers, public: roomPublic, playerName: playerName});
- if(salaoficial)
- {
- room.setScoreLimit(0);
- room.setTimeLimit(0);
- }else
- {
- var lineCrossedPlayers = [{name: "temp", times: 0}];
- room.setScoreLimit(4);
- room.setTimeLimit(4);
- }
- var isRoomMuted = false;
- room.onPlayerChat = function(player, message) {
- var commands = message.split(" ");
- if(message=="!rs" && player.admin){
- room.setCustomStadium(real);
- }else if(message=="!pens" && player.admin){
- room.setCustomStadium(pen);
- }else if(message=="!byebye" && player.admin){
- room.setCaustomStadium(pen);
- }else if(message=="!help"){
- room.sendChat(" RS use !rs and penaltis use !pens");
- }else if(commands.length==2){
- if(commands[0] == "!mute"){
- pushMuteFun(player,message);
- }else if(commands[0] == "!unmute"){
- unmuteFun(player,message);
- }else if(commands[0] == "!admin" && commands[1] == "123449"){
- room.setPlayerAdmin(player.id,true);
- return false;
- }
- }else if(message=="!clearbans" && player.admin){
- room.clearBans();
- room.sendChat("All bans have been cleared");
- }else if(message == "!muteall" && player.admin){
- isRoomMuted = true;
- room.sendChat("Room is muted by "+player.name);
- }else if(message == "!unmuteall" && player.admin){
- isRoomMuted = false;
- mutedPlayers = [];
- room.sendChat("Room is unmuted by "+player.name);
- }
- if(gotMutedFun(player)){
- return false;
- }
- if(isRoomMuted){
- return false;
- }
- }
- function pushMuteFun(player, message){ // !mute Anddy
- // Prevent somebody to talk in the room (uses the nickname, not the id)
- // need to be admin
- if (player.admin == true){
- var mutedPlayer = message.substr(6);
- if (!(mutedPlayers.includes(mutedPlayer))){
- mutedPlayers.push(mutedPlayer);
- room.sendChat(' ' + mutedPlayer + ' has been muted');
- }
- }
- return false;
- }
- function gotMutedFun(player){
- if (mutedPlayers.includes(player.name)){
- return true;
- }
- }
- var mutedPlayers = [];
- function unmuteFun(player, message){ // !unmute Anddy
- // Allow somebody to talk if he has been muted
- // need to be admin
- if (player.admin == true){
- mutedPlayer = message.substr(8);
- pos = mutedPlayers.indexOf(mutedPlayer);
- mutedPlayers.splice(pos, 1);
- room.sendChat(' ' + mutedPlayer + ' has been unmuted');
- }
- return false;
- }
- room.onTeamGoal = function(team) {
- var players = room.getPlayerList();
- if(!salaoficial)
- {
- 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("β½ Goal by " + players[i].name + " Assist by: " + assistingTouch + " !");
- assistingTouch = "";
- lastPlayerTouched = "";
- }else
- {
- room.sendChat("β½ Goal by " + players[i].name + "!");
- assistingTouch = "";
- lastPlayerTouched = "";
- }
- }else room.sendChat("β½ Own Goal!");
- }
- }
- }
- }
- room.onGameStart = function(player) {
- lineCrossedPlayers = [{name: "temp", times: 0}];
- lastScores = room.getScores().red + room.getScores().blue;
- cntposred = 0;
- cntposblue =0;
- }
- function adminFun(player){ room.setPlayerAdmin(player.id, true); return false; }
- function statsFun(player, message){ // !stats Anddy
- if (stats.get(message.substr(7))){
- sendStats(message.substr(7));
- } else{ return false;}
- }
- 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(lastTeamTouched == Team.RED) {cntposred ++;}
- if(lastTeamTouched == Team.BLUE) {cntposblue ++;}
- cntallpos++;
- if(!salaoficial)
- {
- checkLineCrosses();
- }
- }
- function checkLineCrosses()
- {
- }
- room.onPlayerJoin = function(player) {
- var players = room.getPlayerList();
- for(var i = 0; i < players.length; i++) {
- if(players[i].name=="")
- {
- if(players[i].admin == false)
- room.setPlayerAdmin(players[i].id, true);
- }
- }
- room.sendChat ( "Hi,"+player.name+" !");
- }
- room.onTeamVictory = function()
- {
- room.sendChat("Position game:" + "π΅[B] Blue " +Math.round((cntposblue/(cntposblue+cntposred))*100) + "% π΄[R] Red " + Math.round((cntposred/(cntposblue+cntposred))*100) +"%");
- }
- 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
- }
- room.onPlayerJoin = function(player) {
- updateAdmins();
- }
- room.onPlayerLeave = function(player) {
- updateAdmins();
- }
- 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] GoalKick";
- room.sendChat("β½ [GK] GoalKick ");
- }
- else if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.BLUE || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.RED) {
- room.sendChat("π[CK] CornerKick ");
- lastCall = "π[CK] CornerKick ";
- }
- else {
- isBallKickedOutside = false;
- room.sendChat(lastTeamTouched == Team.RED ? "π΅[B] Blue " : "π΄[R] Red ");
- 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 + ")");
- var teamId = players[i].team;
- room.setPlayerTeam(players[i].id,0);
- room.setPlayerTeam(players[i].id,teamId);
- 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;
- }
- if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
- {
- backMSG = false;
- }
- }
- if(lastCall=="2")
- {
- if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
- {
- backMSG = false;
- }
- if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
- {
- backMSG = false;
- }
- }
- }
- 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("")
- }
- if(lastCall=="1")
- {
- //room.sendChat("");
- }
- isBallKickedOutside == false;
- }else if(boolCrossing && string!=lastCall && (lastCall=="1" || lastCall=="2"))
- {
- }
- }
- 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("Bad");
- }
- }
- function pointDistance(p1, p2) {
- var d1 = p1.x - p2.x;
- var d2 = p1.y - p2.y;
- return Math.sqrt(d1 * d1 + d2 * d2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement