Help with jail

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

BryHunter

Member
Jan 10, 2018
35
2
8
27
code_language.skript:
command /setjail:
    trigger:
        if player has permission "staff.setjail":
            set {jail} to location of player
            send "&8[&cJail&8] &7Jail has been set to your current location"

command /jail [<player>] [<text>]:
    trigger:
        if player has permission "staff.helper.jail":
            set {_text} to arg 2 parsed as integer
            if {_text} is less than 10:
                set {beforejail::%arg 1%} to location of arg 1
                teleport arg 1 to {jail}
                set {jail::timer::%arg 1%} to {_text}
                set action bar of arg 1 to "&c&lYou have been jailed for: &e%{jail::timer::%arg 1%}% Minutes"
            else:
                send "&8[&cJail&8] &7You can not jail a player for more than 10 minutes"

command /unjail [<text>]:
    trigger:
        if arg 1 is set:
            set {_player} to arg 1 parsed as player
            teleport {_player} to {beforejail::%{_player}%}
            delete {jail::timer::%arg 1%}
            delete {beforejail::%arg 1%}

every 1 minute:
    loop all players:
        if {jail::timer::%loop-player%} is greater than 0:
            remove 1 from {jail::timer::%loop-player%}
        else if {jail::timer::%loop-player%} is 0:
            delete {jail::timer::%loop-player%}
            teleport loop-player to {beforejail::%loop-player%}
            delete {beforejail::%loop-player%}

idk why this is not working there is no errors, it sets jail and teleports them there just after time set is up nothing happens
 
Wouldn't advise doing it that way but whatever I'm lazy so i'mma re-write it for you in like 1 minute you're welcome love you

code_language.skript:
command /setjail:
    permission: staff.setjail
    trigger:
        set {jail::location} to location of player
        send "&8[&cJail&8] &7Jail has been set to your current location"

command /jail [<player>] [<text>]:
    permission: staff.helper.jail
    trigger:
        if (arg-2 parsed as an integer) is less than 10:
            set {jail::%arg 1%::prior} to location of arg-1
            teleport arg 1 to {jail::location}
            set {jail::%arg 1%::timer} to (arg-2 parsed as an integer)
            send "&8[&cJail&8] &7You have been jailed for &c%{jail::%arg-1%::timer}% minutes" to arg-1
        else:
            send "&8[&cJail&8] &7You can not jail a player for more than 10 minutes"

command /unjail [<player>]:
    trigger:
        if arg 1 is set:
            teleport arg-1 to {jail::%arg-1%::prior}
            delete {jail::%arg-1%::*}

every 1 minute:
    loop all players where [{jail::%input%::timer} is set]:
        if {jail::%loop-player%::timer} is 1:
            teleport loop-player to {jail::%loop-player%::prior}
            delete {jail::%loop-player%::*}
            send "&8[&cJail&8] &7You are no longer jailed!" to loop-player
        else:
            remove 1 from {jail::%loop-player%::timer}

Hurray for inefficiency
 
How would you recommend doing it then because I need each rank like my helpers to only jail 10 min max & trial mods 30 min max etc. If you have a better was I should do it please let me know because I am going to use this for mutes, temp bans, and bans
Wouldn't advise doing it that way but whatever I'm lazy so i'mma re-write it for you in like 1 minute you're welcome love you

code_language.skript:
command /setjail:
    permission: staff.setjail
    trigger:
        set {jail::location} to location of player
        send "&8[&cJail&8] &7Jail has been set to your current location"

command /jail [<player>] [<text>]:
    permission: staff.helper.jail
    trigger:
        if (arg-2 parsed as an integer) is less than 10:
            set {jail::%arg 1%::prior} to location of arg-1
            teleport arg 1 to {jail::location}
            set {jail::%arg 1%::timer} to (arg-2 parsed as an integer)
            send "&8[&cJail&8] &7You have been jailed for &c%{jail::%arg-1%::timer}% minutes" to arg-1
        else:
            send "&8[&cJail&8] &7You can not jail a player for more than 10 minutes"

command /unjail [<player>]:
    trigger:
        if arg 1 is set:
            teleport arg-1 to {jail::%arg-1%::prior}
            delete {jail::%arg-1%::*}

every 1 minute:
    loop all players where [{jail::%input%::timer} is set]:
        if {jail::%loop-player%::timer} is 1:
            teleport loop-player to {jail::%loop-player%::prior}
            delete {jail::%loop-player%::*}
            send "&8[&cJail&8] &7You are no longer jailed!" to loop-player
        else:
            remove 1 from {jail::%loop-player%::timer}

Hurray for inefficiency
 
How would I do that because I tried to do that the first time and it would not let the player type in a time span :/
you type time spans like: 5 minutes. you can also do things like 5 hours and 23 minutes
code_language.skript:
command /setjail:
    permission: staff.setjail
    trigger:
        set {jail::location} to location of player
        send "&8[&cJail&8] &7Jail has been set to your current location"

command /jail [<player>] [<timespan>]:
    permission: staff.helper.jail
    trigger:
        if arg-2 is less than 10 minutes:
            set {jail::%arg 1%::prior} to location of arg-1
            teleport arg 1 to {jail::location}
            set {jail::%arg 1%::timer} to arg-2
            send "&8[&cJail&8] &7You have been jailed for &c%arg-2%" to arg-1
        else:
            send "&8[&cJail&8] &7You can not jail a player for more than 10 minutes"

command /unjail [<player>]:
    trigger:
        if arg 1 is set:
            teleport arg-1 to {jail::%arg-1%::prior}
            delete {jail::%arg-1%::*}

every 1 minute:
    loop all players where [{jail::%input%::timer} is set]:
        if {jail::%loop-player%::timer} is 0 seconds:
            teleport loop-player to {jail::%loop-player%::prior}
            delete {jail::%loop-player%::*}
            send "&8[&cJail&8] &7You are no longer jailed!" to loop-player
        else:
            remove 1 minute from {jail::%loop-player%::timer}
 
Status
Not open for further replies.