WEB game leaderboard problem, please help

Put this in the ready-method of your AdManager:

func _ready():
    ...
    var options = {
            "scopes": true
        }

	Bridge.player.authorize(options, funcref(self, "_on_player_authorize_completed"))

func _on_player_authorize_completed(success):
    if success:
        print("Authorized")
    else:
        print("Authorization error")
1 Like
func _ready() -> void:
	reset_ad_timer()
	Bridge.advertisement.connect("interstitial_state_changed", self, "_on_interstitial_state_changed")
	var options = {
            "scopes": true
        }


	Bridge.player.authorize(options, funcref(self, "_on_player_authorize_completed"))
	
func _on_player_authorize_completed(success):
    if success:
        print("Authorized")
    else:
        print("Authorization error")

like this yes ?(i am just afraid to do some stupid error)

Yes, seems right

1 Like

there is no print(“Authorized”) or print(“Authorization error”) but there was this one


hasAuthValue = true; currentLogin = “ar4mevardanyan” that was my name on the site

Can you beat the highscore?

I have(i just used filter to see only words starting with auth), maybe this leaderboard will start working after moderation ?

Maybe put this print here:

print(Bridge.player.is_authorized)
1 Like
func _on_player_authorize_completed(success):
	print(Bridge.player.is_authorized)

I cant test it on godot yes ?
why one time after exporting my files are 9 pieces but this time there is 12

no not in godot:

func _ready() -> void:
	reset_ad_timer()
	Bridge.advertisement.connect("interstitial_state_changed", self, "_on_interstitial_state_changed")
	var options = {
            "scopes": true
        }


	Bridge.player.authorize(options, funcref(self, "_on_player_authorize_completed"))
    print("is authorized:",Bridge.player.is_authorized)
1 Like



but there wasnt print(“is authorized:”,Bridge.player.is_authorized) but it was authorized.

I dont know why updating the leaderboard fails

func _on_Player_death():
	# Get the current score from Timer1 label
	var current_score = $Timer1.text.to_int()
	print("Player died with score: ", current_score)
	if current_score > highscore:
		# Update the high score if the current score is higher
		highscore = current_score
		AdManager.set_highscore("Player", current_score)
		print("Updating highscore from ", highscore, " to ", current_score)
		save_highscore(highscore)
		if Bridge.platform.language == "ru":
				print("Setting highscore label to Russian")
				$Highscore.text = "рекорд: " + str(highscore)
		if Bridge.platform.language == "en":
				print("Setting highscore label to Russian")
				$Highscore.text = "highscore: " + str(highscore)

maybe there is AdManager.set_highscore(“Player”, current_score) player wrong ?

but you dont use the “Player” inside the method anyway

func set_highscore(name: String, score: float):
    var options = {
        "leaderboardName": "BestTime",
        "score": score
    }
    
    Bridge.leaderboard.set_score(options, funcref(self, "_on_set_score_completed"))

Any gamebreaking errors when you start in godot?

no everything is fine in godot

i am trying to look how working in other games this leaderboard withf12

there was nothing about leaderboards in console

why did we remove yandex from there ?

match Bridge.platform.id:
        "yandex":
            options = {
                "leaderboardName": "leaderboard_name",
                "score": 42
            }

This is just to test in case you publish this game on other platforms

1 Like

okay i cant fix it, anyway i am very grateful that you spent so much amount on time trying to help me fix this, and now i am going to send it to moderation and get canceled :smile: , Thanks !!! :+1: :+1: :+1: :+1: :+1: :+1:

1 Like