Need to cancel player drops every 1 minute

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

    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.

Unreal Drip

Member
May 8, 2022
1
0
1
every 1 minutes:
broadcast "&e&lTIP: &rClearing dropped items in &c&l10 seconds."
wait 10 seconds
broadcast "&e&lTIP: &rCleared &c&l%size of dropped items% &rdropped items."
kill dropped items


Basically want it so you can't drop blocks in the 10sec time frame
 
every 1 minutes:
broadcast "&e&lTIP: &rClearing dropped items in &c&l10 seconds."
wait 10 seconds
broadcast "&e&lTIP: &rCleared &c&l%size of dropped items% &rdropped items."
kill dropped items


Basically want it so you can't drop blocks in the 10sec time frame
Code:
every 1 minutes:
    loop all players:
        if loop-player is online:
            set {cancel_drop::%loop-player's uuid%} to true
            wait a tick
        wait 10 seconds
        delete {cancel_drop::*}

on droping:
    if {cancel_drop::%player's uuid%} is true:
        cancel event
on unload:
    delete {cancel_drop::*}
 
Code:
every 1 minutes:
    loop all players:
        if loop-player is online:
            set {cancel_drop::%loop-player's uuid%} to true
            wait a tick
        wait 10 seconds
        delete {cancel_drop::*}

on droping:
    if {cancel_drop::%player's uuid%} is true:
        cancel event
on unload:
    delete {cancel_drop::*}
This code would not work for players who have joined after the canceldrop variable has been turned on. Instead, set a global variable with no players and check for that.
Code:
every 1 minute:
    set {cancelDrops} to true
    wait 10 seconds
    clear {cancelDrops}
 
on drop:
    if {cancelDrops} is true:
        cancel event
        send "&cError: You are not allowed to drop right now" to player

on unload:
    clear {cancelDrops}
Hope this helps!
 
Status
Not open for further replies.