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