/freeze

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

Well, my script above works for me. I don't know why you got 44 errors.
Anyways, here is a pastebin and file:
http://pastebin.com/z2c7uy10
https://mega.nz/#!hYlWjAzK!VrWt5Fytk2DEJheJYrcbESrdvgNBzW6F3te5CHP9muk
I changed {frozen::%player%} to {frozen.%player%}

@Spirit1998HD , I just tried and Skript ensures the player is online first. I typed /freeze X into the console and X was not online, but I received 'there is no player online whose name starts with X". You can use the loop if you want, I don't really care.
I used an action bar, not bossbar. They're different. Action bars are what you see when you switch tools.
 
Well, my script above works for me. I don't know why you got 44 errors.
Anyways, here is a pastebin and file:
http://pastebin.com/z2c7uy10
https://mega.nz/#!hYlWjAzK!VrWt5Fytk2DEJheJYrcbESrdvgNBzW6F3te5CHP9muk
I changed {frozen::%player%} to {frozen.%player%}

@Spirit1998HD , I just tried and Skript ensures the player is online first. I typed /freeze X into the console and X was not online, but I received 'there is no player online whose name starts with X". You can use the loop if you want, I don't really care.
I used an action bar, not bossbar. They're different. Action bars are what you see when you switch tools.

@A248 Yeah sorry i don't look so long at these part of your code. Action bar is better so it's not the worst idea :emoji_grinning: But also there are servers wich uses the bossbar as messenger and the action bar as some noteable information. :emoji_slight_smile:
 
There's is another way to do this:
Code:
command /freeze [<string>]:
    trigger:
        if arg 1 parsed as player is not set:
            send "&7Usage: /freeze [player]."
            stop
        set gamemode of arg 1 parsed as player to survival
        set walk speed of arg 1 parsed as player to 0
        set fly speed of arg 1 parsed as player to 0
        set hunger of arg 1 parsed as player to 3
        # Requires Bensku's Skript
        set saturation of arg 1 parsed as player to 20
        apply jump 200 to arg 1 parsed as player for 1 day
       
command /unfreeze [<string>]:
    trigger:
        if arg 1 parsed as player is not set:
            send "&7This player is offline."
            stop
        if arg 1 parsed as player doesn't have jump:
            send "&7This player is not freezed."
            stop
        set walk speed of arg 1 parsed as player to 0.2
        set fly speed of arg 1 parsed as player to 0.1
        set hunger of arg 1 parsed as player to 10
        # Requires Bensku's Skript
        set saturation of arg 1 parsed as player to 10
        remove jump from player

Can be upgraded to save player's hunger and saturation.
Doesn't detect anything, so most likely won't cause any lag.
The player can still move if he has a hacked client.
 
Code:
set is flying for player to true
It's doesnt work for me.
@Gatt Which addon is responsible for it?
Because that syntax doesn't make sense...
There's is another way to do this:
Code:
command /freeze [<string>]:
    trigger:
        if arg 1 parsed as player is not set:
            send "&7Usage: /freeze [player]."
            stop
        set gamemode of arg 1 parsed as player to survival
        set walk speed of arg 1 parsed as player to 0
        set fly speed of arg 1 parsed as player to 0
        set hunger of arg 1 parsed as player to 3
        # Requires Bensku's Skript
        set saturation of arg 1 parsed as player to 20
        apply jump 200 to arg 1 parsed as player for 1 day
      
command /unfreeze [<string>]:
    trigger:
        if arg 1 parsed as player is not set:
            send "&7This player is offline."
            stop
        if arg 1 parsed as player doesn't have jump:
            send "&7This player is not freezed."
            stop
        set walk speed of arg 1 parsed as player to 0.2
        set fly speed of arg 1 parsed as player to 0.1
        set hunger of arg 1 parsed as player to 10
        # Requires Bensku's Skript
        set saturation of arg 1 parsed as player to 10
        remove jump from player

Can be upgraded to save player's hunger and saturation.
Doesn't detect anything, so most likely won't cause any lag.
The player can still move if he has a hacked client.
Will test!
 
Because that syntax doesn't make sense...

Will test!

It's make sense

Actually, if you can stay away from using that expression, it'll be better. It was poorly coded, and never fixed up back from my old SkExtras addon; and thus has gone through layers of iteration without a proper recode. It's easy to replicate though with script;

code_language.skript:
function freezePlayer(p: player):
    set fly state of {_p} to true
    set fly speed of {_p} to 0
    set is flying of {_p} to true
    set {frozen::%{_p}%} to true
 
function unfreezePlayer(p: player):
    set {frozen::%{_p}%} to false
    set fly state of {_p} to false
    reset fly speed of {_p}
    set is flying of {_p} to false
 
on flight toggle:
    if {frozen::%player%} is true:
        cancel event

Edit: Made a silly mistake. Fixed.
 
There's is another way to do this:
Code:
command /freeze [<string>]:
    trigger:
        if arg 1 parsed as player is not set:
            send "&7Usage: /freeze [player]."
            stop
        set gamemode of arg 1 parsed as player to survival
        set walk speed of arg 1 parsed as player to 0
        set fly speed of arg 1 parsed as player to 0
        set hunger of arg 1 parsed as player to 3
        # Requires Bensku's Skript
        set saturation of arg 1 parsed as player to 20
        apply jump 200 to arg 1 parsed as player for 1 day
    
command /unfreeze [<string>]:
    trigger:
        if arg 1 parsed as player is not set:
            send "&7This player is offline."
            stop
        if arg 1 parsed as player doesn't have jump:
            send "&7This player is not freezed."
            stop
        set walk speed of arg 1 parsed as player to 0.2
        set fly speed of arg 1 parsed as player to 0.1
        set hunger of arg 1 parsed as player to 10
        # Requires Bensku's Skript
        set saturation of arg 1 parsed as player to 10
        remove jump from player

Can be upgraded to save player's hunger and saturation.
Doesn't detect anything, so most likely won't cause any lag.
The player can still move if he has a hacked client.
Sorry for the bump but can you make it save peoples hunger/heath? :emoji_slight_smile:
Also why are you using [<string>]? Could I replace it with [<player>]?
Also can you put the script in hastebin?
 
Sorry for the bump but can you make it save peoples hunger/heath? :emoji_slight_smile:
Also why are you using [<string>]? Could I replace it with [<player>]?
Also can you put the script in hastebin?

code_language.skript:
command /freeze [<player>]:
    usage: /freeze [<player>]
    trigger:
        set {health.%uuid of arg-1%} to arg-1's health
        set {hunger.%uuid of arg-1%} to arg-1's hunger     
        set gamemode of arg-1 to survival
        set walk speed of arg-1 to 0
        set fly speed of arg-1 to 0
        set hunger of arg-1 to 3
        set saturation of arg-1 to 20
        apply jump 200 to arg-1 for 1 day
      
command /unfreeze [<player>]:
    trigger:
        if arg-1 isn't set:
            send "&7%arg-1% is offline."
            stop
        if arg-1 doesn't have jump:
            send "&7%arg-1% isn't freezed."
            stop
        set arg-1's health to {health.%uuid of arg-1%}
        set arg-1's hunger to {hunger.%uuid of arg-1%}
        delete {health.%uuid of arg-1%}
        delete {hunger.%uuid of arg-1%}
        set walk speed of arg-1 to 0.2
        set fly speed of arg-1 to 0.1
        set saturation of arg-1 to 10
        remove jump from arg-1

Hastebin: https://hastebin.com/nesuyidozu.vbs