BasilYes / godot-yandex-games-sdk

Yandex games SDK implementation for godot
MIT License
85 stars 7 forks source link

when ads completed cannot add rewards #26

Closed kamalasim74 closed 1 month ago

kamalasim74 commented 1 month ago

Hi I am using this sdk for my game. When reward ads completes Rewards not added to players. I am using this method

func _on_rewarded_ad(result: String) -> void:

match result:

    "rewarded":
        rewardad_completed()

    "closed":
        pass

    "opened":
        pass

    "error":
        pass

func rewardad_completed()

here is the code which add rewards

BasilYes commented 1 month ago

You haven't said anything useful to identify your problem. What is the function? Did you use the signal mentioned in the README file? image

kamalasim74 commented 1 month ago

Sorry for my English, I have implemented this sdk in my game which shows rewardAd successfully. But the problem is when rewardAd completed now I want to give user Rewards I am beginner in programming. I have use this method to give rewards to users when rewardAd completes

func _ready():
        YandexSDK.rewarded_ad.connect(_on_rewarded_ad)

func _on_rewarded_ad(result: String) -> void:
    match result:
        "rewarded":
            rewardad_completed()
        "closed":
            pass
        "opened":
            pass
        "error":
            pass

func rewardad_completed():
    Coins += 30
BasilYes commented 1 month ago

Можно по русски если удобно, мой англисский тоже не очень. Did _on_reward_ad called? Try to add print(result) to function and check it in browser debug panel (F12 button, press it before launch the game or find "developer tools" button in your browser)

kamalasim74 commented 1 month ago

Объявления показываются успешно, но не удается добавить награды пользователям после завершения рекламы.

kamalasim74 commented 1 month ago

Можете ли вы дать мне метод, чтобы награждать игроков, когда реклама завершена?

BasilYes commented 1 month ago

Проверь вызывается ли у тебя функция func _ready(): и func _on_rewarded_ad(result: String) -> void: Поставь в них какие-нибудь принты print("ready") и print(result) или что-то типа, запусти на площадке и зайди в дебаг браузера (F12 нажми) и посмотри вызываются ли эти функции

kamalasim74 commented 1 month ago

Это правильный метод для награждения игрока? Если вы используете другой метод, пожалуйста, предоставьте ваш метод.


func _on_rewarded_ad(result: String) -> void:
    match result:
        "rewarded":
            rewardad_completed()
        "closed":
            pass
        "opened":
            pass
        "error":
            pass
BasilYes commented 1 month ago

Yes, I was used this call inside _ready in my game and it's worked

YandexSDK.rewarded_ad.connect(func(result: String) -> void:
        if not result:
            return
        match result:
            "opened":
                pass
            "rewarded":
                reward_func()
            "closed":
                pass
            "error":
                pass
        )
kamalasim74 commented 1 month ago

SDKSS Not working bro. I am using Godot 4.3

BasilYes commented 1 month ago

TRY TO DEBUG IT PLS. Try to add print(result) to function and check it in browser debug panel (F12 button, press it before launch the game or find "developer tools" button in your browser)

kamalasim74 commented 1 month ago

sdk_error

BasilYes commented 1 month ago

get plugin from git, newer version

kamalasim74 commented 1 month ago

ok

BasilYes commented 1 month ago

Did it's work?

BasilYes commented 1 month ago

Looks like you somehow got an older version of the plugin (I checked, I updated it in the asset lib two months ago), so resent README guide didn't work.

kamalasim74 commented 1 month ago

It worked bro thanks.