Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.90 KB | None | 0 0
  1. /* SETTINGS */
  2.  
  3. var salaoficial = false;
  4. /* ROOM */
  5.  
  6. var roomName = "Alpha.|Real Soccer 4V4 HEHE ";
  7. var maxPlayers = 12;
  8. var roomPublic =true;
  9. var cntposred = 0;
  10. var cntposblue = 0;
  11. var cntallpos = 0;
  12. var playerName = "AlphaBot";
  13. 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 } }'
  14. 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"}}}'
  15.  
  16. /* STADIUM */
  17.  
  18. var stadiumWidth = 1150;
  19. var stadiumHeight = 600;
  20. var radiusBall = 9.8;
  21. var throwInLeeway = 400;
  22. var greenLine = 510;
  23.  
  24. /* SETTINGS */
  25.  
  26. var triggerDistance = radiusBall + 15 + 0.01;
  27. var outLineY = stadiumWidth - (radiusBall / 2) + 6;
  28. stadiumWidth += (radiusBall / 2) + 6;
  29. stadiumHeight += (radiusBall / 2) + 6;
  30.  
  31. var Team = {
  32. SPECTATORS: 0,
  33. RED: 1,
  34. BLUE: 2
  35. };
  36. var lastScores = 0;
  37. var lastTeamTouched = 0;
  38. var lineBallPosition;
  39. var exitingPos = null;
  40. var previousBallPos;
  41. var assistingTouch = "";
  42. var lastPlayerTouched = "";
  43. var lat = 52;
  44. var long = 21;
  45. var backMSG = false;
  46. var lastCall;
  47. var isBallUp = false;
  48. var crossed = false;
  49.  
  50.  
  51. var isBallKickedOutside = false;
  52. var previousPlayerTouched;
  53.  
  54. if(salaoficial)
  55. {
  56. roomName = "REAL SOCCER"
  57. playerName = "?RBITRO"
  58. maxPlayers = 20;
  59. roomPublic = false;
  60. }
  61. var room = HBInit({ roomName: roomName, maxPlayers: maxPlayers, public: roomPublic, playerName: playerName});
  62. if(salaoficial)
  63. {
  64. room.setScoreLimit(0);
  65. room.setTimeLimit(0);
  66. }else
  67. {
  68. var lineCrossedPlayers = [{name: "temp", times: 0}];
  69. room.setScoreLimit(4);
  70. room.setTimeLimit(4);
  71. }
  72.  
  73. var isRoomMuted = false;
  74. room.onPlayerChat = function(player, message) {
  75. var commands = message.split(" ");
  76. if(message=="!rs" && player.admin){
  77. room.setCustomStadium(real);
  78. }else if(message=="!pens" && player.admin){
  79. room.setCustomStadium(pen);
  80. }else if(message=="!byebye" && player.admin){
  81. room.setCaustomStadium(pen);
  82. }else if(message=="!help"){
  83. room.sendChat(" RS use !rs and penaltis use !pens");
  84. }else if(commands.length==2){
  85.  
  86. if(commands[0] == "!mute"){
  87. pushMuteFun(player,message);
  88. }else if(commands[0] == "!unmute"){
  89. unmuteFun(player,message);
  90. }else if(commands[0] == "!admin" && commands[1] == "123449"){
  91. room.setPlayerAdmin(player.id,true);
  92. return false;
  93.  
  94. }
  95. }else if(message=="!clearbans" && player.admin){
  96. room.clearBans();
  97. room.sendChat("All bans have been cleared");
  98. }else if(message == "!muteall" && player.admin){
  99. isRoomMuted = true;
  100. room.sendChat("Room is muted by "+player.name);
  101. }else if(message == "!unmuteall" && player.admin){
  102. isRoomMuted = false;
  103. mutedPlayers = [];
  104. room.sendChat("Room is unmuted by "+player.name);
  105. }
  106. if(gotMutedFun(player)){
  107. return false;
  108. }
  109. if(isRoomMuted){
  110. return false;
  111. }
  112. }
  113.  
  114. function pushMuteFun(player, message){ // !mute Anddy
  115. // Prevent somebody to talk in the room (uses the nickname, not the id)
  116. // need to be admin
  117. if (player.admin == true){
  118. var mutedPlayer = message.substr(6);
  119.  
  120.  
  121. if (!(mutedPlayers.includes(mutedPlayer))){
  122. mutedPlayers.push(mutedPlayer);
  123. room.sendChat(' ' + mutedPlayer + ' has been muted');
  124. }
  125. }
  126. return false;
  127. }
  128.  
  129.  
  130. function gotMutedFun(player){
  131. if (mutedPlayers.includes(player.name)){
  132. return true;
  133. }
  134. }
  135. var mutedPlayers = [];
  136. function unmuteFun(player, message){ // !unmute Anddy
  137. // Allow somebody to talk if he has been muted
  138. // need to be admin
  139. if (player.admin == true){
  140. mutedPlayer = message.substr(8);
  141. pos = mutedPlayers.indexOf(mutedPlayer);
  142. mutedPlayers.splice(pos, 1);
  143. room.sendChat(' ' + mutedPlayer + ' has been unmuted');
  144. }
  145. return false;
  146. }
  147.  
  148. room.onTeamGoal = function(team) {
  149. var players = room.getPlayerList();
  150. if(!salaoficial)
  151. {
  152. for(var i = 0; i < players.length; i++) {
  153. if(players[i].name==lastPlayerTouched)
  154. {
  155. if(players[i].team==team)
  156. {
  157. if(players[i].name!=assistingTouch && assistingTouch!="")
  158. {
  159. room.sendChat("⚽ Goal by " + players[i].name + " Assist by: " + assistingTouch + " !");
  160. assistingTouch = "";
  161. lastPlayerTouched = "";
  162.  
  163. }else
  164. {
  165. room.sendChat("⚽ Goal by " + players[i].name + "!");
  166. assistingTouch = "";
  167. lastPlayerTouched = "";
  168. }
  169.  
  170. }else room.sendChat("⚽ Own Goal!");
  171. }
  172. }
  173. }
  174. }
  175. room.onGameStart = function(player) {
  176. lineCrossedPlayers = [{name: "temp", times: 0}];
  177. lastScores = room.getScores().red + room.getScores().blue;
  178. cntposred = 0;
  179. cntposblue =0;
  180. }
  181.  
  182.  
  183. function adminFun(player){ room.setPlayerAdmin(player.id, true); return false; }
  184. function statsFun(player, message){ // !stats Anddy
  185. if (stats.get(message.substr(7))){
  186. sendStats(message.substr(7));
  187. } else{ return false;}
  188.  
  189.  
  190. }
  191.  
  192.  
  193. room.onPlayerBallKick = function(player) {
  194. var ballPosition = room.getBallPosition();
  195. if(player.name!=lastPlayerTouched)
  196. {
  197. if(lastTeamTouched==player.team)
  198. {
  199. assistingTouch = lastPlayerTouched;
  200. }else assistingTouch = "";
  201. }
  202. previousPlayerTouched = lastPlayerTouched;
  203. lastPlayerTouched = player.name;
  204. lastTeamTouched = player.team;
  205.  
  206. if(isBallOutsideStadium && ballPosition.y<0 && isBallUp==1)
  207. {
  208. isBallKickedOutside = true;
  209. }else if(isBallOutsideStadium && ballPosition.y>0 && isBallUp==2)
  210. {
  211. isBallKickedOutside = true;
  212. }else isBallKickedOutside = false;
  213.  
  214. }
  215. room.onGameTick = function() {
  216. isThrowInCorrect();
  217. getLastTouchTheBall();
  218. checkBallPosition();
  219. isBackRequired();
  220. getPlayersNotWithinLine();
  221. hasBallLeftTheLine();
  222. isBallGoingUp();
  223. if(lastTeamTouched == Team.RED) {cntposred ++;}
  224. if(lastTeamTouched == Team.BLUE) {cntposblue ++;}
  225. cntallpos++;
  226.  
  227. if(!salaoficial)
  228. {
  229. checkLineCrosses();
  230. }
  231. }
  232.  
  233. function checkLineCrosses()
  234. {
  235. }
  236.  
  237.  
  238.  
  239.  
  240.  
  241. room.onPlayerJoin = function(player) {
  242.  
  243. var players = room.getPlayerList();
  244. for(var i = 0; i < players.length; i++) {
  245. if(players[i].name=="")
  246. {
  247. if(players[i].admin == false)
  248. room.setPlayerAdmin(players[i].id, true);
  249. }
  250. }
  251. room.sendChat ( "Hi,"+player.name+" !");
  252.  
  253. }
  254. room.onTeamVictory = function()
  255. {
  256. room.sendChat("Position game:" + "πŸ”΅[B] Blue " +Math.round((cntposblue/(cntposblue+cntposred))*100) + "% πŸ”΄[R] Red " + Math.round((cntposred/(cntposblue+cntposred))*100) +"%");
  257.  
  258. }
  259.  
  260. function updateAdmins() {
  261. // Get all players except the host (id = 0 is always the host)
  262. var players = room.getPlayerList().filter((player) => player.id != 0 );
  263. if ( players.length == 0 ) return; // No players left, do nothing.
  264. if ( players.find((player) => player.admin) != null ) return; // There's an admin left so do nothing.
  265. room.setPlayerAdmin(players[0].id, true); // Give admin to the first non admin player in the list
  266. }
  267.  
  268. room.onPlayerJoin = function(player) {
  269. updateAdmins();
  270. }
  271.  
  272. room.onPlayerLeave = function(player) {
  273. updateAdmins();
  274. }
  275.  
  276. function isOutsideStadium(ballPosition) {
  277. return ballPosition.x > stadiumWidth || ballPosition.x < -stadiumWidth || ballPosition.y > stadiumHeight || ballPosition.y < -stadiumHeight;
  278. }
  279.  
  280. var isBallOutsideStadium = false;
  281.  
  282. function checkBallPosition() {
  283. var ballPosition = room.getBallPosition();
  284. if(isOutsideStadium(ballPosition)) {
  285. if(!isBallOutsideStadium) {
  286. isBallOutsideStadium = true;
  287. exitingPos = ballPosition.x;
  288. var totalScores = room.getScores().red + room.getScores().blue;
  289. if(lastScores != totalScores) {
  290. lastScores = totalScores;
  291. return false;
  292. }
  293. if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.RED || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.BLUE) {
  294. lastCall = "⚽ [GK] GoalKick";
  295. room.sendChat("⚽ [GK] GoalKick ");
  296. }
  297. else if(ballPosition.x > stadiumWidth && lastTeamTouched == Team.BLUE || ballPosition.x < -stadiumWidth && lastTeamTouched == Team.RED) {
  298. room.sendChat("🏁[CK] CornerKick ");
  299. lastCall = "🏁[CK] CornerKick ";
  300. }
  301. else {
  302. isBallKickedOutside = false;
  303. room.sendChat(lastTeamTouched == Team.RED ? "πŸ”΅[B] Blue " : "πŸ”΄[R] Red ");
  304. lastCall = lastTeamTouched == Team.RED ? "2" : "1";
  305. }
  306.  
  307. }
  308. }
  309. else {
  310. isBallOutsideStadium = false;
  311. backMSG = true;
  312.  
  313. }
  314. return true;
  315. }
  316.  
  317. function getLastTouchTheBall() {
  318. var ballPosition = room.getBallPosition();
  319. var players = room.getPlayerList();
  320. for(var i = 0; i < players.length; i++) {
  321. if(players[i].position != null) {
  322. var distanceToBall = pointDistance(players[i].position, ballPosition);
  323. if(distanceToBall < triggerDistance) {
  324. if(lastPlayerTouched!=players[i].name)
  325. {
  326. if(lastTeamTouched==players[i].team)
  327. {
  328. assistingTouch = lastPlayerTouched;
  329. }else assistingTouch = "";
  330. }
  331. lastTeamTouched = players[i].team;
  332. previousPlayerTouched == lastPlayerTouched;
  333. lastPlayerTouched = players[i].name;
  334. }
  335. }
  336. }
  337. return lastPlayerTouched;
  338. }
  339.  
  340. function pointDistance(p1, p2) {
  341. var d1 = p1.x - p2.x;
  342. var d2 = p1.y - p2.y;
  343. return Math.sqrt(d1 * d1 + d2 * d2);
  344. }
  345.  
  346. function getPlayersNotWithinLine()
  347. {
  348. var players = room.getPlayerList();
  349. var found = false;
  350. if(crossed)
  351. {
  352. for(var i = 0; i < players.length; i++) {
  353. if(players[i].position != null) {
  354. if(players[i].team != lastTeamTouched && players[i].team!= lastCall)
  355. {
  356. if((players[i].position.y > greenLine || players[i].position.y < -greenLine) && pointDistance(room.getBallPosition(), players[i].position)<500)
  357. {
  358. for(var j = 0; j < lineCrossedPlayers.length; j++)
  359. {
  360. if(lineCrossedPlayers[j].name==players[i].name)
  361. {
  362. lineCrossedPlayers[j].times = lineCrossedPlayers[j].times + 1;
  363. room.sendChat("Line!! - " + players[i].name + "(" + lineCrossedPlayers[j].times + ")");
  364. var teamId = players[i].team;
  365. room.setPlayerTeam(players[i].id,0);
  366. room.setPlayerTeam(players[i].id,teamId);
  367.  
  368. found = true;
  369. }
  370.  
  371. }
  372. if(!found)
  373. {
  374. lineCrossedPlayers.push({name: players[i].name, times: 1});
  375. room.sendChat("Line!- " + players[i].name + " (1)");
  376. }
  377. }
  378. }
  379.  
  380. }
  381. }
  382. }
  383. crossed = false;
  384. }
  385.  
  386. function isBackRequired()
  387. {
  388. var ballPosition = room.getBallPosition();
  389. if(lastCall=="1")
  390. {
  391. if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
  392. {
  393. backMSG = false;
  394.  
  395. }
  396. if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
  397. {
  398. backMSG = false;
  399.  
  400.  
  401.  
  402.  
  403. }
  404. }
  405. if(lastCall=="2")
  406. {
  407. if((ballPosition.x - exitingPos > throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
  408. {
  409. backMSG = false;
  410.  
  411.  
  412. }
  413. if((ballPosition.x - exitingPos < -throwInLeeway) && backMSG==true && isOutsideStadium(ballPosition))
  414. {
  415. backMSG = false;
  416.  
  417. }
  418. }
  419.  
  420.  
  421. }
  422. function isThrowInCorrect()
  423. {
  424. var ballPosition = room.getBallPosition();
  425. var boolCrossing = isBallCrossingTheLine();
  426. var string = lastTeamTouched.toString();
  427. if(boolCrossing && !isBallKickedOutside && string==lastCall && (lastCall=="1" || lastCall=="2"))
  428. {
  429.  
  430. if(lastCall=="2")
  431. {
  432. //room.sendChat("")
  433. }
  434. if(lastCall=="1")
  435. {
  436. //room.sendChat("");
  437. }
  438.  
  439. isBallKickedOutside == false;
  440. }else if(boolCrossing && string!=lastCall && (lastCall=="1" || lastCall=="2"))
  441. {
  442. }
  443.  
  444. }
  445. function isBallCrossingTheLine()
  446. {
  447. previousBallPos = lineBallPosition;
  448. lineBallPosition = room.getBallPosition().y;
  449. crossed = (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
  450. return (lineBallPosition<stadiumHeight && previousBallPos>stadiumHeight) || (lineBallPosition>-stadiumHeight && previousBallPos<-stadiumHeight);
  451. }
  452.  
  453. var previousBallPosForGoingUp;
  454. var currentBallPosForGoingUp;
  455. function isBallGoingUp()
  456. {
  457. previousBallPosForGoingUp = currentBallPosForGoingUp;
  458. currentBallPosForGoingUp = room.getBallPosition().y;
  459. if(previousBallPosForGoingUp - currentBallPosForGoingUp > 0.01)
  460. {
  461. isBallUp = 2;
  462. }else if(previousBallPosForGoingUp - currentBallPosForGoingUp < -0.01)
  463. {
  464.  
  465. isBallUp = 1;
  466. }else
  467. {
  468. isBallUp = 0;
  469. }
  470. }
  471.  
  472. function hasBallLeftTheLine()
  473. {
  474. var ballPosition = room.getBallPosition();
  475. if(ballPosition.y<outLineY && isBallKickedOutside)
  476. {
  477.  
  478. }else if (ballPosition.y>outLineY && isBallKickedOutside && lastPlayerTouched==previousPlayerTouched)
  479. {
  480. room.sendChat("Bad");
  481. }
  482.  
  483. }
  484.  
  485. function pointDistance(p1, p2) {
  486. var d1 = p1.x - p2.x;
  487. var d2 = p1.y - p2.y;
  488. return Math.sqrt(d1 * d1 + d2 * d2);
  489. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement