Solved Issue with creating cooldown of sorts?

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

DanDot8224

Member
Aug 14, 2021
4
1
3
19
so the plan is to have an item
on right click of item
push player upwards
wait 15 seconds before they can use again

having trouble of finding a way round it overlapping meaning when item is clicked it cannot be clicked again until wait time is over.
so I tried making on right click executing a command which I can put a cooldown on when I cam up with this

command /pogo:
trigger:
if {command::%player's uuid%::last-usage} was less than a minute ago:
message "&7[&e&lHumble&7] &cYou're on cooldown! &7Please wait one minute before using this again"
stop
if {command::%player's uuid%::last-usage} was more than minute ago:
push player upwards
message "eee"

taking reference from https://skriptlang.github.io/Skript/conditions.html#CondDate
so

on right click holding a stick:
make player execute command "/pogo"

command /pogo:
trigger:
if {command::%player's uuid%::last-usage} was less than a minute ago:
message "&7[&e&lHumble&7] &cYou're on cooldown! &7Please wait one minute before using this again"
stop
if {command::%player's uuid%::last-usage} was more than minute ago:
push player upwards
message "eee"

this could be completely wrong, looking for input and possible a way around it?
thanks

PASTE BIN:
https://pastebin.com/CuGCxi6t
I also came up with this version which could be closer to solving it? https://pastebin.com/NkSgfJ7F if so then perhaps modifying this would be more efficent?
 
so the plan is to have an item
on right click of item
push player upwards
wait 15 seconds before they can use again

having trouble of finding a way round it overlapping meaning when item is clicked it cannot be clicked again until wait time is over.
so I tried making on right click executing a command which I can put a cooldown on when I cam up with this

command /pogo:
trigger:
if {command::%player's uuid%::last-usage} was less than a minute ago:
message "&7[&e&lHumble&7] &cYou're on cooldown! &7Please wait one minute before using this again"
stop
if {command::%player's uuid%::last-usage} was more than minute ago:
push player upwards
message "eee"

taking reference from https://skriptlang.github.io/Skript/conditions.html#CondDate
so

on right click holding a stick:
make player execute command "/pogo"

command /pogo:
trigger:
if {command::%player's uuid%::last-usage} was less than a minute ago:
message "&7[&e&lHumble&7] &cYou're on cooldown! &7Please wait one minute before using this again"
stop
if {command::%player's uuid%::last-usage} was more than minute ago:
push player upwards
message "eee"

this could be completely wrong, looking for input and possible a way around it?
thanks

PASTE BIN:
https://pastebin.com/CuGCxi6t
I also came up with this version which could be closer to solving it? https://pastebin.com/NkSgfJ7F if so then perhaps modifying this would be more efficent?
There are many tutorial's on cooldowns here:

Code:
on right click holding a stick:
    make player execute command "/pogo"

command /pogo:
    trigger:
        set {_waited.%player's uuid%} to difference between {pogo.lastused.%player's uuid%} and now

        if {_waited.%player's uuid%} is less than minute:
            send "&7[&e&lHumble&7] &cYou're on cooldown! &7Please wait one minute before using this again"
            send "&aTime Left: %difference between a minute and {_waited.%player's uuid%}%"
            stop
        # Here is if the player waited long enough
        push the player upwards
        send "eee"

        set {pogo.lastused.%player's uuid%} to now
 
Status
Not open for further replies.