Solved Kits

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

BestGamerNL

Member
Apr 25, 2017
38
1
0
25
Heey guys i having a problem with my kit skript it is working well but now i want a cooldown for my players otherwise they can spam the kit as many time they want

my code is

code_language.skript:
command /kit [<text>]:
    trigger:
        if arg 1 is "builder":
            message "&a&lBuilder &7kit selected!"
            give 64 cobblestone to player
            give 64 cobblestone to player
            give 64 oak wood to player
            give 64 oak wood to player
            give 1 iron shovel to player
            give 1 iron axe to player
            give 1 iron pickaxe to player
            give 16 obsidian to player

does some one know how to make a cooldown and where i need to place it
 
Heey guys i having a problem with my kit skript it is working well but now i want a cooldown for my players otherwise they can spam the kit as many time they want

my code is

code_language.skript:
command /kit [<text>]:
    trigger:
        if arg 1 is "builder":
            message "&a&lBuilder &7kit selected!"
            give 64 cobblestone to player
            give 64 cobblestone to player
            give 64 oak wood to player
            give 64 oak wood to player
            give 1 iron shovel to player
            give 1 iron axe to player
            give 1 iron pickaxe to player
            give 16 obsidian to player

does some one know how to make a cooldown and where i need to place it

There must be more efficient ways to do this but here you go.

code_language.skript:
command /kit [<text>]:
    trigger:
        if arg 1 is "builder":
            if {kitdelay.%arg 1%::%uuid of player%} is not set:
                set {kitdelay.%arg 1%::%uuid of player%} to now
                set {_yes} to true
            if difference between now and {kitdelay.%arg 1%::%uuid of player%} > 10 seconds:
                set {commanddelay::%uuid of player%} to now
                set {_yes} to true
            if {_yes} is set:
                message "&a&lBuilder &7kit selected!"
                give 64 cobblestone to player
                give 64 cobblestone to player
                give 64 oak wood to player
                give 64 oak wood to player
                give 1 iron shovel to player
                give 1 iron axe to player
                give 1 iron pickaxe to player
                give 16 obsidian to player       
                stop
            set {_time} to "%difference between now and {kitdelay.%arg 1%::%uuid of player%}%"
            set {_text::*} to {_time} split at " seconds"
            set {_time} to "%{_text::1}%" parsed as a number
            set {_left} to 10 - {_time}
            message "&cThis command is delayed you need to wait: %{_left}% seconds"
 
There must be more efficient ways to do this but here you go.

code_language.skript:
command /kit [<text>]:
    trigger:
        if arg 1 is "builder":
            if {kitdelay.%arg 1%::%uuid of player%} is not set:
                set {kitdelay.%arg 1%::%uuid of player%} to now
                set {_yes} to true
            if difference between now and {kitdelay.%arg 1%::%uuid of player%} > 10 seconds:
                set {commanddelay::%uuid of player%} to now
                set {_yes} to true
            if {_yes} is set:
                message "&a&lBuilder &7kit selected!"
                give 64 cobblestone to player
                give 64 cobblestone to player
                give 64 oak wood to player
                give 64 oak wood to player
                give 1 iron shovel to player
                give 1 iron axe to player
                give 1 iron pickaxe to player
                give 16 obsidian to player      
                stop
            set {_time} to "%difference between now and {kitdelay.%arg 1%::%uuid of player%}%"
            set {_text::*} to {_time} split at " seconds"
            set {_time} to "%{_text::1}%" parsed as a number
            set {_left} to 10 - {_time}
            message "&cThis command is delayed you need to wait: %{_left}% seconds"

Less code (Less server usage) and easy to edit cool down time.

Here:

code_language.skript:
options:
    time: 10 minutes

#Change time by changing the above to anything. E.g. 24 hours, 20 seconds, 1 minute ect.
    
command /kit [<text>]:
    trigger:
        if arg 1 is "builder":
            set {_waited.kit.builder.%uuid of player%} to difference between {kit.buildercheck.%uuid of player%} and now
            if {_waited.kit.builder.%uuid of player%} is less than {@time}:
                message "&cYou have used this kit already. Try again in &4%difference between {@time} and {_waited.kit.builder.%uuid of player%}%&c."
                stop
            else:
                set {kit.buildercheck.%uuid of player%} to now
                message "&aBuilder &7kit selected!"
                give 64 cobblestone to player
                give 64 cobblestone to player
                give 64 oak wood to player
                give 64 oak wood to player
                give 1 iron shovel to player
                give 1 iron axe to player
                give 1 iron pickaxe to player
                give 16 obsidian to player
 
Status
Not open for further replies.