Jump to content

Purchase once


g1ps

Recommended Posts

Hello, how can I make these items only available for purchase once?

Thank you

command /Rank:
    trigger:
        open chest with 1 rows named "&a&lРанги" to player
        format gui slot 0 of player with paper named "test1" with lore "1000"
        format gui slot 1 of player with paper named "test2" with lore "2000"
        format gui slot 2 of player with paper named "test3" with lore "3000"

on inventory click:
    if event-item is paper named "test1" with lore "1000":
        cancel event
        if player's balance > 999:
            remove 1000 from player's balance
            execute console command "/giverank test1"
        if player's balance < 999:
            send "&6no money" to player
            cancel event
on inventory click:
    if event-item is paper named "test2" with lore "2000":
        cancel event
        if player's balance > 1999:
            remove 2000 from player's balance
            execute console command "/giverank test2"
        if player's balance < 1999:
            send "&6no money" to player
            cancel event
on inventory click:
    if event-item is paper named "test3" with lore "3000":
        cancel event
        if player's balance > 2999:
            remove 1000 from player's balance
            execute console command "/giverank test3"
        if player's balance < 2999:
            send "&6no money" to player
            cancel event

 

Link to comment
Share on other sites

16 minutes ago, Jockerlight said:

Add a colldown to your Skript 😉

 

I don't think that is what they meant.

@g1ps you can make it a one-time thing by making a global variable that listens to the player's uuid, and if they purchase an item, you can set that variable to true. Then, you can check if that variable is true for that player, it won't give it. Something like this:

on first join:
	set {purchaseState::%uuid of player%} to false

command /test:
	trigger:
		if {purchaseState::%uuid of player%} is false:
			set {purchaseState::%uuid of player%} to true
			send "From now on this true."
			stop

		else if {purchaseState::%uuid of player%} is true:
			send "This true."
			stop

Hope this helps!

Edited by BanditEagle

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

Yeah, do what BanditEagle said-- though if you want to make it more efficient if you have a permissions plugin you can simply give the player a permission when they buy it then when people do the command check if they have that permission. If they do, stop the Skript. Saves variable storage.

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...