Files
grapple_rod.sk
Code
1 44
grapple_rod.sk
options:
grapple-rod-name: &bGrapple Rod
on script load:
delete {grapple.frozen::*}
delete {grapple.freeze-id::*}
command /grapplerod:
permission: grapple.give
trigger:
give player a fishing rod named "{@grapple-rod-name}" with lore "&7Pulls players toward you and holds them still."
send "&aYou received a Grapple Rod." to player
on fishing:
if name of player's tool is "{@grapple-rod-name}":
if caught entity is a player:
cancel event
set {_caster} to player
set {_target} to caught entity
set {_targetId} to uuid of {_target}
loop 10 times:
if {_target} is not online:
stop
if {_caster} is not online:
stop
push {_target} towards location of {_caster} at speed 1
wait 2 ticks
if {_target} is online:
add 1 to {grapple.freeze-id::%{_targetId}%}
set {_freezeId} to {grapple.freeze-id::%{_targetId}%}
set {grapple.frozen::%{_targetId}%} to true
send "&cYou were caught by a Grapple Rod!" to {_target}
wait 3 seconds
if {grapple.freeze-id::%{_targetId}%} is {_freezeId}:
delete {grapple.frozen::%{_targetId}%}
delete {grapple.freeze-id::%{_targetId}%}
on player move:
if {grapple.frozen::%uuid of player%} is set:
cancel event