Solved Daily reward every 24 hours!

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

St4ckY_

New Member
Apr 22, 2020
7
0
1
21
So I need skript for daily reward for my server! So I want command /daily that players can use every 24 hours.
The command should give them specific item, as example lets say "1 diamond". If they used the command today and try to type it again, it will give them message "You can get daily reward once in 24hours!".

Hope you can make it. I know the skript is simple but Im just too bad :emoji_grinning:
 
I'm a bit new to Skript, but this should be working

Code:
command /daily:
    trigger:
        if {time.%player%} is not set:
            set {time.%player%} to 0
            add {server.time} to {time.%player%}
        if {time.%player%} - {server.time} is less than or equal to 0:
            give player 1 diamond
            clear {time.%player%}
            add {server.time} to {time.%player%}
            add 24 to {time.%player%}
        else:
            send "You need to wait %{time.%player%} - {server.time}% Hours to use this command again" to player

every 1 hour:
    add 1 to {server.time}
 
You can use this:

code_language.skript:
on first join:
    set {time::daily::%player%} to 0
   
every hour:
    loop all players:
        if {time::daily::%loop-player%} < 24:
            add 1 to {time::daily::%loop-player%}
on join:
    if {time::daily::%loop-player%} is not set:
        set {time::daily::%loop-player%} to 0
           
command /daily:
    trigger:
        if {time::daily::%player%} => 24:
            set {time::daily::%player%} to 0
            give 1 diamond to player
            send "&eYou reclaimed your daily reward" to player
            broadcast "&e%player%&e has reclaimed his/her daily reward. You can reclaim it using /daily"
        else:
            send "&4&lYou need to wait 24 hours to reclaim your next daily reward"
I don't know if it works, but skUnity Parser says yes. Sorry for my English.
 
You can use this:

code_language.skript:
on first join:
    set {time::daily::%player%} to 0
  
every hour:
    loop all players:
        if {time::daily::%loop-player%} < 24:
            add 1 to {time::daily::%loop-player%}
on join:
    if {time::daily::%loop-player%} is not set:
        set {time::daily::%loop-player%} to 0
          
command /daily:
    trigger:
        if {time::daily::%player%} => 24:
            set {time::daily::%player%} to 0
            give 1 diamond to player
            send "&eYou reclaimed your daily reward" to player
            broadcast "&e%player%&e has reclaimed his/her daily reward. You can reclaim it using /daily"
        else:
            send "&4&lYou need to wait 24 hours to reclaim your next daily reward"
I don't know if it works, but skUnity Parser says yes. Sorry for my English.


That would only pass the time for online players
 
Thanks for the codes! I ended with this one that I made yesterday.

Code:
options:
    prefix: &6&lLight&3&lMines &7»
    cooldown: 24 hours
   
command daily:
    trigger:
        set {_waited} to difference between {dailyReward::%uuid of player%} and now
        if {_waited} is less than {@cooldown}:
            send "{@prefix} You must wait %difference between {@cooldown} and {_waited}% before claiming your daily reward again"
        else:
            set {dailyReward::%uuid of player%} to now
            give player 1 tripwire hook named "&3&lRare&f&l Crate Key" with lore "&7Click on the crate to receive", "&7a random item from the crate."
            send "{@prefix} Here is your daily reward."