Jump to content

i need help adding a cooldown to my skript


rafti

Recommended Posts

on right click on entity holding amethyst shard:
 send "&4Lift power used! " to player 
 push entity up at speed 2.5
 push entity in direction of player at speed 1
 wait 1 second 
 push entity down at speed 2.5

 


how do i add a cooldown to this?

Link to comment
Share on other sites

on load:
	set {cooldown.%player%} to false

on right click on entity holding amethyst shard:
	if {cooldown.%player%} is true:
		send "You are on cooldown!" to player
		stop
	if {cooldown.%player%} is false:
		send "&4Lift power used!" to player
		push entity up at speed 2.5
		push entity in direction of player at speed 1
		wait 1 second
		push entity down at speed 2.5
# COOLDOWN #
		set {cooldown.%player%} to true
		wait 2 seconds
		set {cooldown.%player%} to false

This could be one way. With this your cooldown is 2 seconds, and every player gets their cooldown reset every time the skript is reloaded or the server is restarted too. (you might wanna make it on join if you are worried about them leaving before the cooldown is out)

Edited by xcfgdfg
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...