Claim reward only once

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Le4ft

Member
Jun 26, 2023
20
0
1
19
Hi,
I'm using Skript and Skript-GUI to create a battle pass thing and I'm facing this problem:

How can I make that the reward can be claimed only once?

I'm pasting here part of my code, can anyone please help me?
code_language.skript:
        create a gui with virtual chest inventory with 5 rows named "&6&lBattle Pass" and shape "xxxxxxxxx", "x-------x", "x-123---x", "x-------x", and "xobxpxhxx":
            make gui slot "1" with sunflower named "&6Coins Reward" with lore {@bp1_lore}:
                if {bpxp::%player%} is lower than 10000:
                    set {_needed} to difference between {bpxp::%player%} and 10000

                    cancel event
                    close player's inventory
                    send "&6&lBATTLE PASS! &7You need &b%{_needed}% XP &7to claim this reward!"
                else:
                    send "&6&lBATTLE PASS! &7You received &620,000 Coins&7!"
                    add 20000 to {coins::%player%}

                    set {@bp1_lore} to string "&aClaimed"

                    close player's inventory

                    close player's inventory
 
Code:
create a gui with virtual chest inventory with 5 rows named "&6&lBattle Pass" and shape "xxxxxxxxx", "x-------x", "x-123---x", "x-------x", and "xobxpxhxx":
            make gui slot "1" with sunflower named "&6Coins Reward" with lore {@bp1_lore}:
                if {bpxp::%player%} is lower than 10000:
                    set {_needed} to difference between {bpxp::%player%} and 10000

                    cancel event
                    close player's inventory
                    send "&6&lBATTLE PASS! &7You need &b%{_needed}% XP &7to claim this reward!"
                else:
                    if {bpr1::%player%} is not set:  # Added
                        send "&6&lBATTLE PASS! &7You received &620,000 Coins&7!"
                        add 20000 to {coins::%player%}
                        set {bpr1::%player%} to now # Added

                        set {@bp1_lore} to string "&aClaimed"

                    close player's inventory

                    close player's inventory