Even time....

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

iJDuhb

Active Member
Mar 14, 2017
54
0
6
34
So im wondering about how to do something like on big servers with daily rewards it will say 1.7 hours till you can claim again. or 1.5 days or etc... or 1 second instead of 1.24 seconds

To make it more clear... Instead of the chat sending "You have to wait 35.34 before you can use this again" or something like that i want it like "You have to wait 35 seconds before you can use this again" so practically removing the decimal.. I've tried using whole number and testing if it is whole number which did not work.

https://pastebin.com/BQDkBrw1
 
This should do it. (I know this is not a request, but hay ho.)

code_language.skript:
command /daily:
    trigger:
        set {_waited.%uuid of player%} to difference between now and {lastuseddaily.%uuid of player%}
        if {_waited.%uuid of player%} is more than 1 day:
            open chest with 3 rows named "&2&lDaily Reward" to player
            wait 1 tick
            format slot 13 of player with chest named "&2&lClick to claim daily reward!" to close then run [make player execute command "/dailyreward"]
            message "&2&lDaily Reward &8» &8You have successfully claimed you daily reward."
        else:
            open chest with 3 rows named "&2&lDaily Reward" to player
            wait 1 tick
            if {lastuseddaily.%uuid of player%} is set:
                format slot 13 of player with 160:14 named "&c&lYou can't claim this daily reward yet!" with lore "||&7You need to wait||&c%difference between 24 hours and {_waited.%uuid of player%}%&7" to close
            else:
                format slot 13 of player with chest named "&2&lClick to claim bonus!" to close then run [make player execute command "/dailyreward"]
                message "&2&lDaily Reward &8» &7You have successfully claimed you daily reward."
 
HiddenDev your skript will let you claim it over and over again. And I wanted it to round the number say "you have to wait 35.53 seconds" I want it rounded "35" not 35.53
 
HiddenDev your skript will let you claim it over and over again. And I wanted it to round the number say "you have to wait 35.53 seconds" I want it rounded "35" not 35.53
Donut gave you the expression and function you can use to round a number with a decimal and the reason HiddenDev's code lets you claim over and over again is because he didn't set the variable to now when you successfully claim the reward. Easy fixes
 
Yeah, sorry. I threw it together in about 3 minutes, had to leave the house.

This should fix it.
code_language.skript:
command /daily:
    trigger:
        set {_waited.%uuid of player%} to difference between now and {lastuseddaily.%uuid of player%}
        if {_waited.%uuid of player%} is more than 1 day:
            open chest with 3 rows named "&2&lDaily Reward" to player
            wait 1 tick
            format slot 13 of player with chest named "&2&lClick to claim daily reward!" to close then run [make player execute command "/dailyreward"]
            message "&2&lDaily Reward &8» &8You have successfully claimed you daily reward."
            set {lastuseddaily.%uuid of player%}[B] [/B]to now
        else:
            open chest with 3 rows named "&2&lDaily Reward" to player
            wait 1 tick
            if {lastuseddaily.%uuid of player%} is set:
                format slot 13 of player with 160:14 named "&c&lYou can't claim this daily reward yet!" with lore "||&7You need to wait||&c%difference between 24 hours and {_waited.%uuid of player%}%&7" to close
            else:
                format slot 13 of player with chest named "&2&lClick to claim bonus!" to close then run [make player execute command "/dailyreward"]
                message "&2&lDaily Reward &8» &7You have successfully claimed you daily reward."
 
Can't understand this condition/effect: set {lastuseddaily.%uuid of player%} to now (skywars.sk, line 68: set {lastuseddaily.%uuid of player%} to now')

and for donuts please make an example in a send " you have to wait" ...
 
By any chance have you put this in?
code_language.skript:
set {lastuseddaily.%uuid of player%}[B] [/B]to now

If so just remove those B (Bold)
code_language.skript:
set {lastuseddaily.%uuid of player%} to now
 
Can't understand this condition/effect: set {lastuseddaily.%uuid of player%} to now (skywars.sk, line 68: set {lastuseddaily.%uuid of player%} to now')

and for donuts please make an example in a send " you have to wait" ...
Im not going to spoonfeed you

for dev's code isnt line 4 supposed to be
code_language.skript:
set {_waited.%uuid of player%} to difference between {lastuseddaily.%uuid of player%} and now
not
code_language.skript:
set {_waited.%uuid of player%} to difference between now and {lastuseddaily.%uuid of player%}
 
I dont feel like explaining so heres your spoonfeeding
code_language.skript:
set {timeString} to "%{time}%"
set {timeString::*} to {timeString} split at " "
loop {timeString::*}:
    if "%loop-value parsed as a number%" is not "<none>":
        replace "%loop-value%" in {timeString} with "%rounded (loop-value parsed as number)%"

broadcast "Not rounded: %{time}%"
broadcast "Rounded: %{timeString}%"
this will round every decimal in the time but it doesnt really matter because i dont think there could ever be more than 1 decimal in a time span
 
Yeah, sorry. I threw it together in about 3 minutes, had to leave the house.

This should fix it.
code_language.skript:
command /daily:
    trigger:
        set {_waited.%uuid of player%} to difference between now and {lastuseddaily.%uuid of player%}
        if {_waited.%uuid of player%} is more than 1 day:
            open chest with 3 rows named "&2&lDaily Reward" to player
            wait 1 tick
            format slot 13 of player with chest named "&2&lClick to claim daily reward!" to close then run [make player execute command "/dailyreward"]
            message "&2&lDaily Reward &8» &8You have successfully claimed you daily reward."
            set {lastuseddaily.%uuid of player%}[B] [/B]to now
        else:
            open chest with 3 rows named "&2&lDaily Reward" to player
            wait 1 tick
            if {lastuseddaily.%uuid of player%} is set:
                format slot 13 of player with 160:14 named "&c&lYou can't claim this daily reward yet!" with lore "||&7You need to wait||&c%difference between 24 hours and {_waited.%uuid of player%}%&7" to close
            else:
                format slot 13 of player with chest named "&2&lClick to claim bonus!" to close then run [make player execute command "/dailyreward"]
                message "&2&lDaily Reward &8» &7You have successfully claimed you daily reward."
Why are you storing by uuid on a local variable? Also, you should be using list variables and avoid using format slot.
 
for my server if I have coin balance I want the coins to stay if the player will change their name. so if I use uuid that will never change... and my server is already all format slot and it would be to much work changing it, and I havent had a problem with it.

Answer it Pikachu?
 
Why are you storing by uuid on a local variable? Also, you should be using list variables and avoid using format slot.
Because I never had chance to change it to save %player% as UUID's, I mean you don't need to know rocket science to change it.
 
for my server if I have coin balance I want the coins to stay if the player will change their name. so if I use uuid that will never change... and my server is already all format slot and it would be to much work changing it, and I havent had a problem with it.

Answer it Pikachu?
Storing by uuid is good. It's just useless on local vars. Format slot can be stolen from
 
would this be able to get stolen "format slot 0 of player with stick named "test" with lore "test" to be unstealable "
 
Status
Not open for further replies.