Need help with some Timed Loop Stuff

  • 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!

Status
Not open for further replies.

Jande

Member
Jan 1, 2020
2
0
1
21
Skript Version: 2.4
Minecraft Version: 1.15.1

So, I'm making a thing called Class. So when a player first joins, the player will be prompted with a GUI Menu, and to choose one of the 2 classes: One is Warrior and the other is Builder. The player cannot close the GUI. Once the player has chosen a Class, they cannot change the class for the next 7 days. (I managed to add a cooldown to /class). Also, here are the Perks for both of the classes:

Builder:
  1. 1 Cobble stone every 10 seconds (Until 64 Max)
  2. Discount on /shop
  3. Haste 1 Effect
  4. Custom Missions
Warrior:
  1. Sharpness 1 on Sword
  2. Custom Missions
  3. etc...
Here is what I have managed so far:
Code:
command /class:
    trigger:
        set {_cooldownTimer} to difference between {class.%player%.lastused} and now
        if {_cooldownTimer} is less than 10 seconds:
            send "&b&lBanknote &8» &7You cannot change your class for the next &b%difference between 7 days and {_cooldownTimer}%&7!"
            stop
        else:
            open virtual chest with 1 rows with name "&b&lBanknote &0» &8&lClasses" to player
            loop integers between 0 and 8:
                make gui slot loop-integer of player with gray stained glass pane with name ""
            make gui slot 3 of player with white wool with name "&b&lBUILDER &f&lCLASS" with lore "&8Information" and "" and "&7Perks:" and "" and "&8» &bCobble Stone &f- &7Get &f1 &7per Second" and "&8» &bDiscount &f- &710%% Discount on &bTier 1, 2, 3 &7Blocks" and "&8» &bPickaxe Effect &f- &7Effect &f1 &7on Pickaxe" and "&8» &bMissions &f- &7Custom Missions" and "&8» &bPotion &f- &7Have &b∞ &fHaste I &7Effect" to close:
                send "&b&lBanknote &8» &7You Successfully chose &bBuilder &7Class!"
                set {class.%player%.lastused} to now
                send title "&b&lCLASS" with subtitle "&fYou chose the &b&lBUILDER &fClass!" to {_p} for 3 seconds

every 5 seconds:
    set {_cooldownTimer} to difference between {class.%player%.lastused} and now
    if {_cooldownTimer} is less than 10 second:
        every 1 second in "world1":
            if player does not have 64 cobblestone:
                give a cobblestone to player

However, this code is wrong...

The Question I have is: How do I make it such that, the Class Perks are available for 7 days only? And in a Loop? And the loop stops when 7 Days are over (GUI pops up again). I tried this with Functions, but couldn't figure out how to do...

Addons I'm using: TuSKe 1.8.2, SkRayFall 1.9.18

Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? I've tried looking at similar Skripts, but found none.
[doublepost=1577936328,1577862250][/doublepost]Please Help!!!
The Main Question is: How do I make it such that, the Class Perks are available for 7 days only? And in a Loop? And the loop stops when 7 Days are over (GUI pops up again). I tried this with Functions, but couldn't figure out how to do...
 
So you are saying that when the player first joins, they get prompted with a GUI that allows them to change a class which gives them special perks, and your wondering how you can make it so that they have to choose a different class a week after choosing?
 
So you are saying that when the player first joins, they get prompted with a GUI that allows them to change a class which gives them special perks, and your wondering how you can make it so that they have to choose a different class a week after choosing?
Yes... And also, how do I make it loop for 7 days and stop the loop after that? (Giving Player 1 Cobblestone/10 seconds)
[doublepost=1577939144,1577939010][/doublepost]Maybe Something like declaring a boolean, and every 5 seconds, the boolean will be checked. If its true, a piece of code runs, and if not, then gui will be prompted again.
 
The problem I could see here with skript is that when the server shuts down, the skript will pause and it would last much longer than a week.
 
Status
Not open for further replies.