Solved Event Cooldown Problem

  • 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.
Jan 8, 2019
3
0
0
So, I tried to make a cooldown for events and it worked, but I still have one problem with it. When I use event and it sets on cooldown, another player can't use this event because I used it and it set on cooldown. How to do a thing so that when a player uses event and it sets on cooldown only for player that used this event?

Example Code:
# variables that show event's cooldown and last use of event
variables:
{example.cooldown} = 5
{example.lastused} = 5
# cancels event while cooldown of event is greater than last use of event
on right click with sword:
{example.lastused} < {example.cooldown}
cancel event
# does effects if last use of event is equal to cooldown of event
on right click with sword:
{example.lastused} is equal to {example.cooldown}
shoot a fireball from player at velocity 2.5
send action bar "Start of cooldown" to player
set {example.lastused} to 0 # sets last use of event to 0 seconds and starts cooldown
loop {example.cooldown} times:
wait 1 second
add 1 to {example.lastused}
send action bar "End of cooldown" to player # activates when last use of event is equal to cooldown of event

 
Status
Not open for further replies.