haxball / haxball-issues

115 stars 43 forks source link

Question About ScoresObject #1142

Closed whiteofsnow closed 3 years ago

whiteofsnow commented 4 years ago

Hi to those who will be interested with this issue,

I have been trying to stop the game if the scores of both teams are equal and the time has exceeded the maximum limit by typing if(scores.red == scores.blue && scores.time > scores.timeLimit) { room.stopGame; } on the event named room.onTeamVictory = function(scores) but it doesn’t work. It returns the score statuses but when it comes to getting the elapsed seconds of time and maximum time limit values while using .time and .timeLimit variables from ScoresObject, it stops working. How can I perceive those two ones on my operation? I had tried something different but the methods that I used didn’t work as well. If you want me to share the whole code here, sorry I don’t wanna do it but I can share the relevant parts.

I hope this will be solved as soon as possible with your help, thank you.

Skarmunds commented 4 years ago

It's not team victory. Perhaps try look into this example https://github.com/haxball/haxball-issues/blob/master/headless/examples/gameTime.js.

whiteofsnow commented 4 years ago

Got it, thanks! I thought it was working well on the team victory event.