Offhand swap delay

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

AidenKing

New Member
Feb 5, 2022
5
0
1
Server Version: Paper-406 (MC:1.17.1)
Skript Version: 2.6 Addons: skDragon v0.17.5 skRayFall v1.9.26 SkQuery v4.1.4

I have searched and I am not looking for how to detect what is in the offhand.
I want to detect an offhand swap and if it has been detected within the last 3 seconds then cancel event of offhand swap

on offhand move:
if repeated 3 seconds ago
cancel event​

How do i put that ^^^ inside a code thing?
this is my first post on here if i did anything wrong please tell me cause idk how this works.
 
Code:
on swap hand items:
    if {cooldown.swap::%player%} is not true:
        if player doesn't have permission "cooldown.bypass.swap":
            set {cooldown.swap::%player%} to true
            wait 3 seconds
            delete {cooldown.swap::%player%}
    else:
        cancel event

I really wish there was a way to detect if something has happened in the last 3 seconds, but unfortunately the best way of doing this that I can think of is by putting the cooldown of the player in a variable. For storage purposes I'm deleting the cooldown variable instead of setting it to false.
 
Code:
on swap hand items:
    if {cooldown.swap::%player%} is not true:
        if player doesn't have permission "cooldown.bypass.swap":
            set {cooldown.swap::%player%} to true
            wait 3 seconds
            delete {cooldown.swap::%player%}
    else:
        cancel event

I really wish there was a way to detect if something has happened in the last 3 seconds, but unfortunately the best way of doing this that I can think of is by putting the cooldown of the player in a variable. For storage purposes I'm deleting the cooldown variable instead of setting it to false.
Thx how do i do the Code (TEXT):??? im new to this stuff
Also if possible do you know how i can use time in skript so i can easily use it to do timed things as in 3 pm execute console command "broadcast EPIC" or something
 
Status
Not open for further replies.