Solved way to freeze players

  • 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.

Uzumaki

Well-Known Member
Feb 20, 2017
310
10
18
33
best way to freeze players?

- without
code_language.skript:
on any move: event

- addons.

skquery.
skellet.
skrayfall.
tuske.
 
Last edited:
I use this:
"set freeze state of player to true" with Umbaska
My Umbaska Version is 3.3 and spigot version is 1.8.8
 
I made a function for this a while ago, you must have skellett installed for the metadata syntax, if you don't have it or want to install it then just edit my code to use a variable instead of metadata, here you go:

code_language.skript:
function freezeplayer(p: player , forceyaw&pitch: boolean):
    if metadata value "Frozen" of {_p} is not set:
        set metadata value "Frozen" of {_p} to true
        set {_loc} to location({_p}'s x-coordinate, {_p}'s y-coordinate, {_p}'s z-coordinate, {_p}'s world)
        if {_forceyaw&pitch} is true:
            set {_loc} to {_p}'s location
        set {_p}'s walk speed to 0
        while metadata value "Frozen" of {_p} is set:
            if distance between {_p} and {_loc} is greater than 0.1:
                teleport {_p} to {_loc}
            else if {_forceyaw&pitch} is true:
                if {_p}'s yaw is not equal to {_loc}'s yaw:
                    teleport {_p} to {_loc}
                else if {_p}'s pitch is not equal to {_loc}'s pitch:
                    teleport {_p} to {_loc}
            wait 1 tick
function unfreezeplayer(p: player):
    set {_p}'s walk speed to 0.2
    delete metadata value "Frozen" of {_p}

the freeze function has to arguments, the first is the player you wish to freeze and the second on is for whether you want to force yaw and pitch to the player, if you don't force it they can look around but not move, if you do force it they are stuck looking towards the direction the where looking at when frozen. example commands below:

code_language.skript:
command /freeze <player>:
    trigger:
        freezeplayer(arg-1 , true)
command /unfreeze <player>:
    trigger:
        unfreezeplayer(arg-1)
 
I made a function for this a while ago, you must have skellett installed for the metadata syntax, if you don't have it or want to install it then just edit my code to use a variable instead of metadata, here you go:

code_language.skript:
function freezeplayer(p: player , forceyaw&pitch: boolean):
    if metadata value "Frozen" of {_p} is not set:
        set metadata value "Frozen" of {_p} to true
        set {_loc} to location({_p}'s x-coordinate, {_p}'s y-coordinate, {_p}'s z-coordinate, {_p}'s world)
        if {_forceyaw&pitch} is true:
            set {_loc} to {_p}'s location
        set {_p}'s walk speed to 0
        while metadata value "Frozen" of {_p} is set:
            if distance between {_p} and {_loc} is greater than 0.1:
                teleport {_p} to {_loc}
            else if {_forceyaw&pitch} is true:
                if {_p}'s yaw is not equal to {_loc}'s yaw:
                    teleport {_p} to {_loc}
                else if {_p}'s pitch is not equal to {_loc}'s pitch:
                    teleport {_p} to {_loc}
            wait 1 tick
function unfreezeplayer(p: player):
    set {_p}'s walk speed to 0.2
    delete metadata value "Frozen" of {_p}

the freeze function has to arguments, the first is the player you wish to freeze and the second on is for whether you want to force yaw and pitch to the player, if you don't force it they can look around but not move, if you do force it they are stuck looking towards the direction the where looking at when frozen. example commands below:

code_language.skript:
command /freeze <player>:
    trigger:
        freezeplayer(arg-1 , true)
command /unfreeze <player>:
    trigger:
        unfreezeplayer(arg-1)

Thanks a lot, Works perfectly.

That's a really bad way of doing it.

code_language.skript:
on script load:
  import "org.bukkit.metadata.FixedMetadataValue"
  import "org.bukkit.Bukkit"
  set {metadata::Skript} to {Bukkit}.getPluginManager().getPlugin("Skript")
function setMetadata(n: string, t: object, o: object):
  set {_args::*} to {_n} and new {FixedMetadataValue}({metadata::Skript} and {_o})
  if {_o} is not null ref:
    {_t}.setMetadata({_args::*});
  else:
    set {_args::*} to {_n} and {metadata::Skript}
    {_t}.removeMetadata({_args::*});
function getMetadata(n: string, t: object) :: object:
  return (first element out of ...{_t}.getMetadata({_n}).toArray()).value()
function deleteMetadata(n: string, t: object):
  setMetadata({_n}, {_t}, null ref)
function freeze(entities: entities):
  loop {_entities::*}:
    spawn armor stand at loop-value
    set {_stand} to last spawned entity
    setMetadata("freezeStand", {_stand}, true)
    {_stand}.setVisible(false);
    {_stand}.setGravity(false);
    try {_stand}.setInvulnerable(true);
    make loop-value dismount
    make loop-value ride {_stand}
function unfreeze(entities: entities):
  loop {_entities::*} where [getMetadata("freezeStand", vehicle of entity input) is true]:
    delete vehicle of loop-value
on packet event play_client_steer_vehicle:
  if getMetadata("freezeStand", vehicle of player) is true:
    set boolean pinfo 1 of event-packet to false
with skript-mirror, skquery and mundosk
 
Without addons
code_language.skript:
apply jump boost 250 to player for 999 days
apply slowness 250 to player for 999 days
apply blindness 250 to player for 999 days
apply mining fatigue 250 to player for 999 days
 
Without addons
code_language.skript:
apply jump boost 250 to player for 999 days
apply slowness 250 to player for 999 days
apply blindness 250 to player for 999 days
apply mining fatigue 250 to player for 999 days
This is bypassable
 
If i remember correctly if you hold w and spam space really fast you can move
By putting such a high value on the effects of potion, you prevent the player from moving or jumping. I have it applied to my server and it is effective, it can not be moved in any way or remove the effect with milk.
 
By putting such a high value on the effects of potion, you prevent the player from moving or jumping. I have it applied to my server and it is effective, it can not be moved in any way or remove the effect with milk.
I tested it on my server and I can't move but I can still jump so I can jump foward, and you can still remove the effect with milk.
 
Status
Not open for further replies.