Solved Freeze Skript

  • 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 community!

    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!

AdenR84

Active Member
Sep 4, 2023
112
1
18
here is a freeze skript:
feel free to edit it and upgrade it
 

Attachments

  • freeze (1).sk
    659 bytes · Views: 362
here is a freeze skript:
feel free to edit it and upgrade it
To be honest, I probably didn't need to modify the code you provided as much as I did, but here it is and listed below the code are the changes I made:

Code:
on join:
    set {_p} to player
    if player is op:
        if {Staff::*} doesn't contain {_p}:
            add {_p} to {Staff::*}
command /freeze <player>:
    permission: essential.freeze
    permission message: &cYou Need Permission To Run That Command!
    trigger:
        set {_u} to arg-1's uuid
        if {f::%{_u}%} isn't set:
            set arg-1's walk speed to 0
            set {f::%{_u}%} to arg-1's position
            send "&c%arg-1% &bhas been frozen by %player%!" to {Staff::*}
        else:
            set arg-1's walk speed to 0.2
            clear {f::%{_u}%}
            send "&7%arg-1% &bhas been unfrozen by %player%!" to {Staff::*}
every second:
    loop all players:
        set {_u} to loop-player's uuid
        set {_l} to position of loop-player
        if {f::%{_u}%} is not equal to {_l}:
            teleport loop-player to {f::%{_u}%}
on quit:
    set {_u} to player's uuid
    if {f::%{_u}%} is set:
        send "&e! Warning: &b%player% &3(frozen) &bhas left!" to {Staff::*}
Change #1: Made /freeze and /unfreeze into a singular command
Change #2: Fixed issue with command which would make the player who ran it become frozen (Via variable data)
Change #3: Made it so that only "Staff" players (Whom are opped) will see who's frozen/unfrozen and by who (You can make a command to add unopped players to Staff)
Change #4: Removed excess events that were unnecessary for the revamp I did for freezing a player
Change #5: Made it so that the frozen variable is shorter and stores the coordinate of the frozen player (Could be used to verify if they are/aren't hacking)
Change #6: Changed the main frozen variable to be attached to the player's uuid (If not, if a player's username is changed, they can evade a freeze)
 
Hey, you can try this:
Code:
on join:
    if {freezed::%uuid of player%} is not set:
        set {freezed::%uuid of player%} to false

command /freeze <player>:
    permission: freeze.use
    permission message: &cYou do not have permissions to do this!
    trigger:
        if {freezed::%uuid of arg-1%} is false:
            if arg-1 does not have permission "freeze.bypass":
                if player is not executor:
                    set {freezed::%uuid of arg-1%} to true
                    set walk speed of arg-1 to 0
                    send "&c%arg-1% &awas frozen!" to player
                    send title "&cYou were frozen!" to arg-1 for 3 seconds
                    set {e::%uuid of arg-1%} to uuid of executor
                else:
                    send "&cYou can not freeze yourself!" to player
            else:
                send "&cYou can not freeze player %arg-1%!" to player
        else:
            send "&cPlayer %arg-1% is already frozen!" to player

command /unfreeze <player>:
    permission: unfreeze.use
    permission message: &cYou do not have permissions to do this!
    trigger:
        if {freezed::%uuid of arg-1%} is true:
            set {freezed::%uuid of arg-1%} to false
            set walk speed of arg-1 to 0.2
            send "&c%arg-1% &awas unfrozen!" to player
            send title "&aYou were unfrozen!" to arg-1 for 3 seconds
        else:
            send "&cPlayer %arg-1% is not frozen!" to player

on command:
    if {freezed::%uuid of player%} is true:
        cancel event

on quit:
    if {freezed::%uuid of player%} is true:
        set {_executor} to {e::%uuid of player%} parsed as offline player
        send "&cPlayer &c&l%player% &cleft while he was frozen!" to {_executor}

on player move:
    if {freezed::%uuid of player%} is true:
        cancel event

on chat:
    if {freezed::%uuid of player%} is true:
        cancel event
        send "&cYou're frozen, you can't use chat!" to player

on right click:
    if {freezed::%uuid of player%} is true:
        cancel event

on left click:
    if {freezed::%uuid of player%} is true:
        cancel event
    
on damage of player:
    if {freezed::%uuid of attacker%} is true:
        cancel event
I made some things like he cant do while he is frozen so he cant escape, also i made like double protection to move in case one doesn't work.
 
  • Like
Reactions: SpionLennart