Solved daily quest skript

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

    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!

lolib

Member
Oct 2, 2019
12
1
3
How can I add a 1-day cooldown to this quest?
Code:
if {dq1.zombidie::%player%} = 10:
    set {dq1.durum::%player%} to "&a&lcompleted"
    send "&amission completed" to player
    add 100 to player's money
else:
    send "&cYou didn't kill enough zombies." to player
 
Last edited:
currently working on this comment, just testing some stuffs (since I see you online)

What plugins do you have by the way?
 
First, SHARE THE WHOLE DAMN CODE NEXT TIME. :emoji_smiley:

Now, based on the snippet you sent me, we're gonna create a 'unix timestamp' variable to get what time it will be when the cooldown is over.

Basically, a unix timestamp allows us to get the exact date and time of what we want, no matter the time zone.

Now, what we have to keep in mind is that each player has their own cooldown, so we have to make the cooldown subjective by using the player's uuid expression. UUID stands for Unique ID, so we're just getting the unique ID of the player. We're gonna put this at the end of the code later.
Code:
set {zombiecd::%player's uuid%} to unix timestamp of (now + 24 hours)

Next, we have to check to see if the cooldown is over. I hardly have any context thanks to your snippet, but we'll just go with what we got.
Code:
if unix timestamp of now > {zombiecd::%player's uuid%}:
    # code

Now, if the condition returns false, we have to display an error message,
Code:
else:
    set {_time} to unix date of {zombiecd::%player's uuid%} formatted as "MM/d hh:mm:ss a"
    send "&cYou must wait until %{_time}% to try again."

Now, with the expression unix date, what we're doing is getting the date of the cooldown based off of the timezone. Then, we format it to get the text that we want. The text, based off of the formatting, would look something like this:

11/11 1:24:43 AM


Now, we can put it all together, and it would look something like the spoiler. (It's a spoiler in case you want to try and do it yourself.)


Code:
on chat: # I have it set to an on chat event BECAUSE OF YOUR DAMN SNIPPET, PASTE THE WHOLE DAMN CODE NEXT TIME
    if unix timestamp of now > {zombiecd::%player's uuid%}:
        if {dq1.zombidie::%player%} = 10:
            set {dq1.durum::%player%} to "&c&lYapıldı"
            send "&amission completed" to player
        else:
            send "&cYou didn't kill enough zombies." to player
    else:
        set {_time} to unix date of {zombiecd::%player's uuid%} formatted as "MM/d h:mm:ss a"
        send "&cYou must wait until %{_time}% to try again."
    set {zombiecd::%player's uuid%} to unix timestamp of (now + 24 hours)

Let me know if you have any issues.
 
Last edited:
  • Like
Reactions: lolib