Freeze Script

Share scripts you wrote for Denizen-Bukkit here!
Post Reply
Posts: 18
Joined: January 29th, 2020, 4:40 pm

Freeze Script

Post by Berufeng » June 23rd, 2020, 6:02 pm

This is a little task script that can be run to freeze a player in place seamlessly. Please check the commented lines to make sure you're not accidentally disabling flight for players that should have flight permissions.

This script will allow frozen players the freedom to rotate their camera and character. If you are looking for a way to freeze their camera controls as well, the preferred method is to simply create an NPC clone of the player in their place and spectate the player onto the NPC. If there is interest, I can add a simple task script that does that as an alternative, in this forum post.

Run this task using
- run Freeze_Task def:<player>|freeze or
- run Freeze_Task def:<player>|unfreeze

Here's a link to a haste:

Or click the spoiler to view the script in this post:

Code: Select all

  type: task
  debug: false
  # Call this task with "- run Freeze_Task def:<player>|(un}freeze"
  definitions: player|2
    - choose <[2]>:
      - case unfreeze:
        - flag <[player]> frozen:!
        - adjust <[player]> flying:false
        - adjust <[player]> fov_multiplier:0.0
        # Change the tag here if you have flight enabled for non-ops.
        # Example: if !<player.has_permission[SomePermission]>:
        - if !<player.is_op>:
          - adjust <[player]> can_fly:false
      - case freeze:
        - flag <[player]> frozen
        - adjust <[player]> can_fly:true
        - adjust <[player]> fly_speed:0.0
        - teleport <[player]> <[player].location.add[0,0.001,0]>
        - adjust <[player]> flying:true
        - adjust <[player]> fov_multiplier:0.0

  type: world
  debug: false
    on player stops flying flagged:frozen:
      - determine cancelled

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest