Jump to content

Can't get cooldown to work, please help


ZorxCue

Recommended Posts

on step on pressure plate:
    
    set {_cooldown} to difference between {cooldown::%player%} and now
    if {_cooldown} is less than 10 seconds:
        message "Cooldown  You gotta wait: &f%Difference between {_cooldown} and 10 seconds%"
        wait 10 seconds
    else:
        make console execute "effect give %player% regeneration 5 2"
        set {cooldown::%player%} to now
        message "no cooldown"
            
 I don't know what I did wrong, when go on a pressure plate, it'll just give me regeneration effect instantly every second, instead of waiting till cooldown is done       
 

Best regards: Zorx

Edited by ZorxCue
Link to comment
Share on other sites

  • ZorxCue changed the title to Can't get cooldown to work, please help

you needed a cancel event because then the event would just keep going

on step on pressure plate:
    set {_cooldown} to difference between {cooldown::%player%} and now
    if {_cooldown} is less than 10 seconds:
    cancel event
        message "Cooldown  You gotta wait: &f%Difference between {_cooldown} and 10 seconds%"
        wait 10 seconds
    else:
        make console execute "effect give %player% regeneration 5 2"
        set {cooldown::%player%} to now
        message "no cooldown"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...