Solved Freeze player

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
code_language.skript:
set %player%'s walk speed to 0

This will still allow the player to move via jumping, which can be surpressed with some potion stuff.
 
I had someone a few days ago asking for something like this, so I quickly whipped this up.
This one has a command to freeze the player, and a command to unfreeze the player.
Also its written so if the player logs out and then logs in again, it will continue the freeze
code_language.skript:
command /freeze <player>:
    trigger:
        set {freeze::%arg-1%} to location of arg-1
        set {_x} to x coord of arg-1
        set {_z} to z coord of arg-1
        set {_y} to y coord of arg-1
        while arg-1 is online:
            if {freeze::%arg-1%} is set:
                if x coord of arg-1 is not {_x}:
                    teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
                if z coord of arg-1 is not {_z}:
                    teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
                if y coord of arg-1 is not {_y}:
                    teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
                wait 3 tick
            else:
                stop

command /unfreeze <player>:
    trigger:
        delete {freeze::%arg-1%}

on join:
    set {_x} to x coord of arg-1
    set {_z} to z coord of arg-1
    set {_y} to y coord of arg-1
    while arg-1 is online:
        if {freeze::%arg-1%} is set:
            if x coord of arg-1 is not {_x}:
                teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
            if z coord of arg-1 is not {_z}:
                teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
            if y coord of arg-1 is not {_y}:
                teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
            wait 3 tick
        else:
            stop
 
I had someone a few days ago asking for something like this, so I quickly whipped this up.
This one has a command to freeze the player, and a command to unfreeze the player.
Also its written so if the player logs out and then logs in again, it will continue the freeze
code_language.skript:
command /freeze <player>:
    trigger:
        set {freeze::%arg-1%} to location of arg-1
        set {_x} to x coord of arg-1
        set {_z} to z coord of arg-1
        set {_y} to y coord of arg-1
        while arg-1 is online:
            if {freeze::%arg-1%} is set:
                if x coord of arg-1 is not {_x}:
                    teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
                if z coord of arg-1 is not {_z}:
                    teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
                if y coord of arg-1 is not {_y}:
                    teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
                wait 3 tick
            else:
                stop

command /unfreeze <player>:
    trigger:
        delete {freeze::%arg-1%}

on join:
    set {_x} to x coord of arg-1
    set {_z} to z coord of arg-1
    set {_y} to y coord of arg-1
    while arg-1 is online:
        if {freeze::%arg-1%} is set:
            if x coord of arg-1 is not {_x}:
                teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
            if z coord of arg-1 is not {_z}:
                teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
            if y coord of arg-1 is not {_y}:
                teleport arg-1 to location({_x}, {_y}, {_z}, world of arg-1)
            wait 3 tick
        else:
            stop
Wow, it's super well optimized, thank you very much! :emoji_smile:
However, your connection event is set to an argument and not player. But even fixed, it crash my server :emoji_sweat_smile:
 
Ah sorry, I copy/pasted the command to make the event (for some reason I didn't have it saved)
So here it is I fixed it
code_language.skript:
on join:
    set {_x} to x coord of player
    set {_z} to z coord of player
    set {_y} to y coord of player
    while player is online:
        if {freeze::%arg-1%} is set:
            if x coord of player is not {_x}:
                teleport playaer to location({_x}, {_y}, {_z}, world of player)
            if z coord of player is not {_z}:
                teleport player to location({_x}, {_y}, {_z}, world of player)
            if y coord of player is not {_y}:
                teleport player to location({_x}, {_y}, {_z}, world of player)
            wait 3 tick
        else:
            stop
 
Ah sorry, I copy/pasted the command to make the event (for some reason I didn't have it saved)
So here it is I fixed it
code_language.skript:
on join:
    set {_x} to x coord of player
    set {_z} to z coord of player
    set {_y} to y coord of player
    while player is online:
        if {freeze::%arg-1%} is set:
            if x coord of player is not {_x}:
                teleport playaer to location({_x}, {_y}, {_z}, world of player)
            if z coord of player is not {_z}:
                teleport player to location({_x}, {_y}, {_z}, world of player)
            if y coord of player is not {_y}:
                teleport player to location({_x}, {_y}, {_z}, world of player)
            wait 3 tick
        else:
            stop
As usual, a good job. Thank you so much !
Thanks also to Jaylawl, but that's not really what I was looking for. I had already seen this possibility on another thread.
 
As usual, a good job. Thank you so much !
Thanks also to Jaylawl, but that's not really what I was looking for. I had already seen this possibility on another thread.
Glad to help. sorry about the first error, I was in a rush to get it on here for ya and stupidly forgot to change the arg's
 
Status
Not open for further replies.