Files
confusion-staff.sk
Code
1 80
confusion-staff.sk
options:
prefix: &6[Berlo Zmieszania]&r
radius: 10
duration: 5
cooldown: 60
item-name: &5&lBerlo Zmieszania
on right click with blaze rod:
if name of player's tool is "{@item-name}":
if {confusion.cooldown::%player%} is set:
send "{@prefix} &cCooldown active! Wait %difference between now and {confusion.cooldown::%player%}% more." to player
stop
set {_affected} to 0
loop all players in radius {@radius} around player:
if loop-player is not player:
add 1 to {_affected}
set {confusion.active::%loop-player%} to true
set {confusion.ticks::%loop-player%} to ({@duration} * 20)
send "{@prefix} &cYour controls have been reversed!" to loop-player
play sound "entity.elder_guardian.curse" with volume 1 and pitch 1.5 to loop-player
apply nausea 2 to loop-player for {@duration} seconds
if {_affected} is 0:
send "{@prefix} &cNo enemies within {@radius} blocks!" to player
stop
send "{@prefix} &aConfused %{_affected}% enemies for {@duration} seconds!" to player
play sound "entity.evoker.cast_spell" with volume 1 and pitch 1 to player
set {confusion.cooldown::%player%} to now
wait {@cooldown} seconds
delete {confusion.cooldown::%player%}
every 1 tick:
loop all players:
if {confusion.active::%loop-player%} is true:
subtract 1 from {confusion.ticks::%loop-player%}
if {confusion.ticks::%loop-player%} <= 0:
delete {confusion.active::%loop-player%}
delete {confusion.ticks::%loop-player%}
send "{@prefix} &aYour controls are back to normal!" to loop-player
else:
set {_vel} to loop-player's velocity
set {_vx} to x-coordinate of {_vel}
set {_vy} to y-coordinate of {_vel}
set {_vz} to z-coordinate of {_vel}
set {_speed} to sqrt(({_vx}^2) + ({_vz}^2))
if {_speed} > 0.05:
set {_newVX} to {_vx} * -2.5
set {_newVZ} to {_vz} * -2.5
set loop-player's velocity to vector({_newVX}, {_vy}, {_newVZ})
on quit:
delete {confusion.active::%player%}
delete {confusion.ticks::%player%}
delete {confusion.cooldown::%player%}
command /confusionstaff [<text>]:
permission: confusion.admin
aliases: /cstaff
trigger:
if arg-1 is "give":
give player 1 blaze rod named "{@item-name}" with lore "&7Right-click to confuse enemies", "&7within {@radius} blocks for {@duration} seconds", "" and "&aCooldown: {@cooldown}s"
send "{@prefix} &aYou received the Confusion Staff!" to player
else:
send "{@prefix} &eUsage:" to player
send "&7/confusionstaff give &f- Get the staff" to player
command /dajberlozamieszania:
trigger:
if player is op:
give player 1 blaze rod named "{@item-name}" with lore "&7Right-click to confuse enemies", "&7within {@radius} blocks for {@duration} seconds", "" and "&aCooldown: {@cooldown}s"
send "{@prefix} &aYou received the Confusion Staff!" to player
else:
send "{@prefix} &cOnly OPs can use this command!" to player