how do i add this?

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

bobby2002

Active Member
Nov 24, 2017
50
0
0
I got the minutes to work but i cant think a way to get minutes and seconds to work together when the do /nextclear. this is what i got so far:
code_language.skript:
options:
    prefix: &8<&2ClearLag&8>&e
    
variables:
    {minute} = 0
    
command /nextclear:
    permission: timer.clear
    trigger:
        if {minute} is less than 2:
            message "&aNext clear is in&c %{minute}% Minute"
        else:
            message "&aNext clear is in&c %{minute}% Minutes"


every 1 seconds:
    clear {_count}
    loop all entities:
        if entity is not a player:
            clear loop-entity
            add 1 to {_count}
        if {_count} is not set:
            set {_count} to 0
    broadcast "{@prefix} &cRemoved &4%{_count}% &cEntities!"
    set {minute} to 5
    
every 60 seconds:
    remove 1 from {minute}
 
This entire thing isn't coded very well. It sounds like you just want something to clear all non-player entities every five minutes with a command to allow you to let you know how long until the next clear is, right? If so, you should do something like this:

code_language.skript:
every 5 minutes:
    set {_cleared} to 0
    set {lastClearTime} to now
    loop all entities:
        if loop-entity isn't a player:
            clear loop-entity
            add 1 to {_cleared}
    broadcast "{@prefix} &cRemoved &4%{_cleared}%&c entities!"

command /nextclear:
    permission: timer.clear
    trigger:
        set {_timeSinceClear} to difference between {lastClearTime} and now
        message "&aNext clear is in &c%difference between 5 minutes and {_timeSinceClear}%&a."
 
  • Like
Reactions: BrettPlayMC
Status
Not open for further replies.