Solved Kit List Permission check assistance

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

Jacob105

Active Member
Aug 7, 2020
65
1
8
24
wow it's been a while... I'm trying to make a softcoded kit system with a /kit list command.
however, for users that do not have permission to view kits with assigned permissions, I want them hidden from the list and replaced with another kit.
Note:
all variables are correctly defined

Code:
                loop 6 times:
                    loop {kits::*}:
                        if {_items} is greater than 6:
                            stop loop
                        if {_z} is not set:
                            stop loop
                        if {_kits::*} doesn't contain loop-value-2:
                            add loop-value-2 to {_kits::*}
                        set {_k} to {_kits::%{_z}%}
                        if {kits::%{_k}%::perm} is set:
                            send ""
                            if executor has permission "kits.%{kits::%{_k}%::perm}%":
                                set {_n} to {kits::%{_k}%::display}
                                set {_d} to {kits::%{_k}%::desc}
                                if {_k} is not set:
                                    stop loop
                                add 1 to {_z}
                                send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                                add 1 to {_items}
                        else:
                            set {_n} to {kits::%{_k}%::display}
                            set {_d} to {kits::%{_k}%::desc}
                        if {_k} is not set:
                            stop loop
                        add 1 to {_z}
                        send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                        add 1 to {_items}

Skript version + addons
Skript 2.6.5-for-1.8
Sk-gui 1.3
 
Last edited:
WAIT WHAT

Yep.
AppleScript:
on join:
    set attack speed attribute of player to 26
(if this doesn't work try using the base Minecraft command)
AppleScript:
on join:
    execute console command "attribute %player% minecraft:generic.attack_speed base set 26"
 
Just updated it, when a kit has a permission set, and the player doesn't have permission to view it, it isn't shown which is good.
But now I need it to display 6 items per page, and when a player cannot see a rank, it only shows 5...
Code:
                if arg-2 is not set:
                    set {_page} to 1
                else:
                    set {_page} to arg-2 parsed as integer
                if {_page} is not set:
                    set {_page} to 1
                set {_cnt} to size of {kits::*}
                set {_pa} to ceil({_cnt}/6)
                if {_page} is greater than {_pa}:
                    send "&cThis page does not exist."
                    stop
                if {_page} is 0:
                    send "&cThis page does not exist."
                    stop
                send "&7&m------------------------------------------------"
                send "&d&lKits list &bPage %{_page}%/%{_pa}% - (/kit <kit>)"
                send " "
                set {_items} to 1
                set {_z} to (({_page} - 1) * 6) + 1
                loop 6 times:
                    loop {kits::*}:
                        if {_items} is greater than 6:
                            stop loop
                        if {_z} is not set:
                            stop loop
                        if {_kits::*} doesn't contain loop-value-2:
                            add loop-value-2 to {_kits::*}
                        set {_k} to {_kits::%{_z}%}
                        set {_n} to {kits::%{_k}%::display}
                        set {_d} to {kits::%{_k}%::desc}
                    if {_k} is not set:
                        stop loop
                    add 1 to {_z}
                    if {kits::%{_k}%::perm} is set:
                        if executor doesn't have permission "shockwave.kits.%{kits::%{_k}%::perm}%":
                            add 1 to {_items}
                            send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                    else:
                        add 1 to {_items}
                        send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                send "&7&m------------------------------------------------"
 
Can you like...send the full code? I have no clue what {_z} and {_k} and {_n} and {_items} are meant to be-
Sure,
Code:
            else if arg-1 is "list":
                if arg-2 is not set:
                    set {_page} to 1
                else:
                    set {_page} to arg-2 parsed as integer
                if {_page} is not set:
                    set {_page} to 1
                set {_cnt} to size of {kits::*}
                set {_pa} to ceil({_cnt}/6)
                if {_page} is greater than {_pa}:
                    send "&cThis page does not exist."
                    stop
                if {_page} is 0:
                    send "&cThis page does not exist."
                    stop
                send "&7&m------------------------------------------------"
                send "&d&lKits list &bPage %{_page}%/%{_pa}% - (/kit <kit>)"
                send " "
                set {_items} to 1
                set {_z} to (({_page} - 1) * 6) + 1
                loop 6 times:
                    loop {kits::*}:
                        if {_items} is greater than 6:
                            stop loop
                        if {_z} is not set:
                            stop loop
                        if {_kits::*} doesn't contain loop-value-2:
                            add loop-value-2 to {_kits::*}
                        set {_k} to {_kits::%{_z}%}
                        set {_n} to {kits::%{_k}%::display}
                        set {_d} to {kits::%{_k}%::desc}
                    if {_k} is not set:
                        stop loop
                    add 1 to {_z}
                    if {kits::%{_k}%::perm} is set:
                        if executor has permission "shockwave.kits.%{kits::%{_k}%::perm}%":
                            add 1 to {_items}
                            send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                        else:
                            send {_items}
                    else:
                        add 1 to {_items}
                        send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                send "&7&m------------------------------------------------"
 
Last edited:
Sure,
Code:
            else if arg-1 is "list":
                if arg-2 is not set:
                    set {_page} to 1
                else:
                    set {_page} to arg-2 parsed as integer
                if {_page} is not set:
                    set {_page} to 1
                set {_cnt} to size of {kits::*}
                set {_pa} to ceil({_cnt}/6)
                if {_page} is greater than {_pa}:
                    send "&cThis page does not exist."
                    stop
                if {_page} is 0:
                    send "&cThis page does not exist."
                    stop
                send "&7&m------------------------------------------------"
                send "&d&lKits list &bPage %{_page}%/%{_pa}% - (/kit <kit>)"
                send " "
                set {_items} to 1
                set {_z} to (({_page} - 1) * 6) + 1
                loop 6 times:
                    loop {kits::*}:
                        if {_items} is greater than 6:
                            stop loop
                        if {_z} is not set:
                            stop loop
                        if {_kits::*} doesn't contain loop-value-2:
                            add loop-value-2 to {_kits::*}
                        set {_k} to {_kits::%{_z}%}
                        set {_n} to {kits::%{_k}%::display}
                        set {_d} to {kits::%{_k}%::desc}
                    if {_k} is not set:
                        stop loop
                    add 1 to {_z}
                    if {kits::%{_k}%::perm} is set:
                        if hasPermission(executor, "shockwave.kits.%{kits::%{_k}%::perm}%") is true:
                            add 1 to {_items}
                            send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                        else:
                            send {_items}
                    else:
                        add 1 to {_items}
                        send "&8⇨ &r%{_n}% &8- &r%{_d}%"
                send "&7&m------------------------------------------------"
still not the full code :emoji_slight_smile:
 
dude its not like people will be like
ooo this one guy on one website posted an obscure thing that im probably not gonna use im just going to steal it from them and use it by myself without giving credit oooohhh
 
dude its not like people will be like
ooo this one guy on one website posted an obscure thing that im probably not gonna use im just going to steal it from them and use it by myself without giving credit oooohhh
thanks for your unwanted input!
 
i don't want to leak the dang skript, can ya help me from this?
I uhh...can't really help if i don't have the code. If it's really that important you can send it to me in a private message by clicking the name under my profile picture and then clicking "Start conversation"
 
I uhh...can't really help if i don't have the code. If it's really that important you can send it to me in a private message by clicking the name under my profile picture and then clicking "Start conversation"
actually, here.
Code:
command /kitlist [<text>]:
    trigger:
        if arg-1 is not set:
            set {_page} to 1
        else:
            set {_page} to arg-1 parsed as integer
        if {_page} is not set:
            set {_page} to 1
        set {_cnt} to size of {kits::*}
        set {_pa} to ceil({_cnt}/6)
        if {_page} is greater than {_pa}:
            send "&cThis page does not exist."
            stop
        if {_page} is 0:
            send "&cThis page does not exist."
            stop
        send "&7&m------------------------------------------------"
        send "&d&lKits list &bPage %{_page}%/%{_pa}% - (/kit <kit>)"
        send " "
        set {_items} to 1
        set {_z} to (({_page} - 1) * 6) + 1
        loop 6 times:
            loop {kits::*}:
                if {_items} is greater than 6:
                    stop loop
                if {_z} is not set:
                    stop loop
                if {_kits::*} doesn't contain loop-value-2:
                    add loop-value-2 to {_kits::*}
                set {_k} to {_kits::%{_z}%}
                if {kits::%{_k}%::perm} is set:
                    if executor has permission "shockwave.kits.%{kits::%{_k}%::perm}%":
                        set {_n} to {kits::%{_k}%::display}
                        set {_d} to {kits::%{_k}%::desc}
                else:
                    set {_n} to {kits::%{_k}%::display}
                    set {_d} to {kits::%{_k}%::desc}
            if {_k} is not set:
                stop loop
            add 1 to {_z}
            add 1 to {_items}
            send "&8⇨ &r%{_n}% &8- &r%{_d}%"
        send "&7&m------------------------------------------------"