haxball / haxball-issues

115 stars 43 forks source link

Headless Connection problem #716

Closed kjnn closed 5 years ago

kjnn commented 5 years ago

Hello, i have a problem when i deploy the headless javascript(i tested the first script posted on headless documentation) to headless url. The following error are showed mozilla: screen_4001_mozilla chrome/opera: screen_4001_chrome

I also tried to disable the "Block scripts loaded via document.write" flag and to try an older version of chrome but the error persists.. I remember that last summer i was able to deploy it without any problem, what do you suggest?

olehmisar commented 5 years ago

What if just paste the code in the console? Also, try this code:

var loader = document.createElement('script')
loader.src = 'protocol://path/to/the/code'
document.body.append(loader)
kjnn commented 5 years ago

When i said deploy i meant pasting the code in the console and press enter and after the recaptcha and inserting nickname that error is showed. About your code, how should i integrate it with script? im copying the first example here https://github.com/haxball/haxball-issues/wiki/Headless-Host.

olehmisar commented 5 years ago

Do you have any errors on the host page? I mean haxball.com/headless.

kjnn commented 5 years ago

no

olehmisar commented 5 years ago

Are other people able to join your room? Try to create a regular (not headless) room and join it. Tell me if you can join.

kjnn commented 5 years ago

Yes i don't have any problem with normal room

olehmisar commented 5 years ago

Paste your code here.

Also try this code:

HBInit({ public: true })

and tell me if the error still appears.

kjnn commented 5 years ago

var room = HBInit({ roomName: "My room", maxPlayers: 16 }); room.setDefaultStadium("Big"); room.setScoreLimit(5); room.setTimeLimit(0);

// 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 }

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

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

The error still appears even if i type only HBInit({ public: true })

olehmisar commented 5 years ago

Looks like I cannot help you with this. Wait for @basro's response.

dmaddd commented 5 years ago

HELP

kjnn commented 5 years ago

It was my mistake...i was opening the room in the same window of the headless one, sorry :D

olehmisar commented 5 years ago

Close the issue, please.