Nothing works when trying to apply cooldown

Discussion in 'Skript' started by zacharycram, Jul 30, 2020.

  1. I am trying to make a script to prevent other players from looting the attacker's items. When I try to apply a cooldown so only the attacker can loot it before anyone else, it doesn't work. can anyone help me? (there are no errors)
    Code (Text):
    options:
        enabledforMobs: false
        prefix: [&6AL&f]
        timetopreventloot: 1
     

    on death:
        attacker is a player
        victim is a player
        set {loottimer::%attacker%} to true
        set {_t} to {loottimer::%attacker%}
        set {_t} to {_t} parsed as a player
        "%region at player%" contains "__global__" or "closed" or "closed2" or "oldcac"
        send "{@prefix} &cYou have {@timetopreventloot} seconds to loot your items before anyone else can loot your items!" to attacker
        set {_count} to 2
        set {lwv::%player%} to true
        while {_count} is set:
            wait 1 second
            if {loottimer::%attacker%} is not set:
                stop
            if {loottimer::%victim%} is not set:
                stop
            if {_count} is 2:
                clear {lwv::%player%}
            if {_count} is less than 2:
                if {lwv::%player%} is set:
                    clear {lwv::%player%}
                    set {_count} to 3
            set {_count} to {_count} - 1
            if {_count} is less than 1:
                clear {lwv::%attacker%}
    on pick up:
        while {_count} is set:
            if player is not "{_t}":
                cancel event
                send "{@prefix} unable to loot" to player

    on pick up:
        if {@enabledforMobs} is false:
            stop
        else:
            send "{@prefix} &cYou have {@timetopreventloot} seconds to loot your mob drops before anyone else can loot your items!" to player
       
     
  2. that is really inefficient way of making cooldowns, I've made a skript addon dedicated to cooldowns making that you could try

    (usage:
    create cooldown "name" for 5 seconds
    if cooldown "name" is over:
    ) it's optimized to work well for very many cooldowns (think millions of cooldowns)

    and it doesn't work for you because you're using {_t} which doesn't exist in that event and you never delete {_count}
     

    Attached Files:

  3. Code (Text):
    on death:
        attacker is a player
        victim is a player
        set {loottimer::%attacker%} to true
        set {_t} to {loottimer::%attacker%}
        set {_t} to {_t} parsed as a player
    Sorry, I am curious. Why did you parse 'true' boolean as a player?
     
    • Agree Agree x 1
  4. I did a mistake in that code, lol, didn't see that error.
     
  5. You only provided one option, is there a doc or something that i can look at to see all the usages
     
  6. I haven't released the add-on yet, so there is not until I find time to finish it
     
  7. #Excitement