And make it so no matter what the thing will not happen again
[doublepost=1648851397,1648851192][/doublepost]you see, im tryin to make it so that random events occur in my kitpvp, but when i made a while script with a varible, when i quickly toggle on and off the script, it runs two of them, because the while loop resumes when i run the command, but even when i have an end loop, if i quickly toggle it then it doesnt sense the varible has changed in time.
here is the code in it:
command /pvpon:
trigger:
send "&2&lPowering on Pvp Events!"
set {Randomizer} to 0
set {events} to true
wait 5 seconds
while {events} is true:
set {Randomizer} to random integer between 2 and 4
set {_player} to random element of all players
if {Randomizer} = 2:
send "Giving &b&lswiftness 4 &rto &6%{_player}%!"
wait 5 second
apply swiftness 4 to {_player}
if {Randomizer} = 3:
send "Giving &a&ljump boost 7 &rto &6%{_player}%!"
wait 5 second
apply jump boost 7 to {_player}
if {Randomizer} = 4:
send "Giving &4&lstrength 10 &rto &6all players!"
wait 5 second
apply strength 10 to all players
if {Randomizer} = 5:
send "&5&lLEVITATION TIME IN 10 SECONDS!"
wait 5 second
send "&5&lLEVITATION TIME IN 5 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 4 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 3 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 2 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 1 SECONDS!"
wait 1 second
send "&5&l&nLEVITATION TIME!"
apply levitation 2 to all players
apply levitation 2 to all players
wait 10 seconds
apply slow falling 1 to all players
apply slow falling 1 to all players
if {Randomizer} = 6:
send "Giving &e&lAbsorption 10 &rto &6%{_player}%!"
wait 5 second
apply absorption 10 to {_player}
if {Randomizer} = 7:
send "Giving swiftness 2 to %{_player}%!"
wait 5 second
apply swiftness 2 to {_player}
if {Randomizer} = 8:
send "Giving swiftness 2 to %{_player}%!"
wait 5 second
apply swiftness 2 to {_player}
if {Randomizer} = 1:
send "Giving swiftness 2 to %{_player}%!"
wait 5 second
apply swiftness 2 to {_player}
wait 25 seconds
if {events} is false:
stop loop
command /pvpoff:
trigger:
send "&4&lPowering off Pvp Events!"
set {events} to false
command /test:
trigger:
set {events} to false
[doublepost=1648851397,1648851192][/doublepost]you see, im tryin to make it so that random events occur in my kitpvp, but when i made a while script with a varible, when i quickly toggle on and off the script, it runs two of them, because the while loop resumes when i run the command, but even when i have an end loop, if i quickly toggle it then it doesnt sense the varible has changed in time.
here is the code in it:
command /pvpon:
trigger:
send "&2&lPowering on Pvp Events!"
set {Randomizer} to 0
set {events} to true
wait 5 seconds
while {events} is true:
set {Randomizer} to random integer between 2 and 4
set {_player} to random element of all players
if {Randomizer} = 2:
send "Giving &b&lswiftness 4 &rto &6%{_player}%!"
wait 5 second
apply swiftness 4 to {_player}
if {Randomizer} = 3:
send "Giving &a&ljump boost 7 &rto &6%{_player}%!"
wait 5 second
apply jump boost 7 to {_player}
if {Randomizer} = 4:
send "Giving &4&lstrength 10 &rto &6all players!"
wait 5 second
apply strength 10 to all players
if {Randomizer} = 5:
send "&5&lLEVITATION TIME IN 10 SECONDS!"
wait 5 second
send "&5&lLEVITATION TIME IN 5 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 4 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 3 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 2 SECONDS!"
wait 1 second
send "&5&lLEVITATION TIME IN 1 SECONDS!"
wait 1 second
send "&5&l&nLEVITATION TIME!"
apply levitation 2 to all players
apply levitation 2 to all players
wait 10 seconds
apply slow falling 1 to all players
apply slow falling 1 to all players
if {Randomizer} = 6:
send "Giving &e&lAbsorption 10 &rto &6%{_player}%!"
wait 5 second
apply absorption 10 to {_player}
if {Randomizer} = 7:
send "Giving swiftness 2 to %{_player}%!"
wait 5 second
apply swiftness 2 to {_player}
if {Randomizer} = 8:
send "Giving swiftness 2 to %{_player}%!"
wait 5 second
apply swiftness 2 to {_player}
if {Randomizer} = 1:
send "Giving swiftness 2 to %{_player}%!"
wait 5 second
apply swiftness 2 to {_player}
wait 25 seconds
if {events} is false:
stop loop
command /pvpoff:
trigger:
send "&4&lPowering off Pvp Events!"
set {events} to false
command /test:
trigger:
set {events} to false