Solved Command Shop

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

Status
Not open for further replies.

LandonPlayz

New Member
Feb 18, 2017
8
0
0
I have this code, it is a command shop. It is to where you can add commands to the gui shop by doing /addcmd. There are no errors but when you open the gui, everything works as intended but when you click on one, it always does like the last one. Here is a video to show you what I am talking about:


Code:
code_language.skript:
        if {cmds1} <= 9:
            open chest with 1 row named "Available Commands" to player
        else:
            if {cmds1} <= 18:
                open chest with 2 rows named "Available Commands" to player
            else:
                if {cmds1} <= 27:
                    open chest with 3 rows named "Available Commands" to player
                else:
                    if {cmds1} <= 36:
                        open chest with 4 rows named "Available Commands" to player
                    else:
                        if {cmds1} <= 45:
                            open chest with 5 rows named "Available Commands" to player
                        else:
                            if {cmds1} <= 54:
                                open chest with 6 rows named "Available Commands" to player
        if {cmds1} >= 0:
            set {_slots} to -1
            loop {commands2::*}:
                add 1 to {_slots}
                set {balance::%player%} to player's balance
                if {commandhas1::%player%::%loop-value%} is true:
                    format slot {_slots} of player with a green stained glass pane named "&a&l/%{commands2::%loop-value%}%" with lore "&7You have unlocked this command." to be unstealable
                else:
                    if {balance::%player%} >= {commandsprice2::%loop-value%}:
                        format slot {_slots} of player with a red stained glass pane named "&c&l/%{commands2::%loop-value%}%" with lore "||&6&l* &6&lPrice: &b&l$%{commandsprice2::%loop-value%}%||   &6&l- &eBalance: &7%{balance::%player%}%||   &6&l- &ePrice Per Use: &7$%{commandsppu2::%loop-value%}%||||&6&l* Percentage: &b&l100%%||&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆||||&a&lREADY||&7You have enough money to unlock||&7this command. Click to unlock." to close then run [remove {commandsprice2::%loop-value%} from player's balance]->[set {commandhas1::%player%::%loop-value%} to true]->[send "&c&l- $%{commandsprice2::%loop-value%}%"]->[send "&aYou have unlocked /%{commands2::%loop-value%}%!"]
                    else:
                        set {percent.%player%} to {balance::%player%}/{commandsprice2::%loop-value%}
                        set {percent2.%player%} to {percent.%player%}*100
                        if {percent2.%player%} <= 5.9:
                            set {progress.%player%} to "&e&l▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆"
                        else:
                            if {percent2.%player%} <= 10.99:
                                set {progress.%player%} to "&e&l▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆"
                            else:
                                if {percent2.%player%} <= 15.99:
                                    set {progress.%player%} to "&e&l▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆"
                                else:
                                    if {percent2.%player%} <= 20.99:
                                        set {progress.%player%} to "&e&l▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆"
                                    else:
                                        if {percent2.%player%} <= 25.99:
                                            set {progress.%player%} to "&e&l▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆"
                                        else:
                                            if {percent2.%player%} <= 30.99:
                                                set {progress.%player%} to "&e&l▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆"
                                            else:
                                                if {percent2.%player%} <= 35.99:
                                                    set {progress.%player%} to "&e&l▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆▆"
                                                else:
                                                    if {percent2.%player%} <= 40.99:
                                                        set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆▆"
                                                    else:
                                                        if {percent2.%player%} <= 45.99:
                                                            set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆▆"
                                                        else:
                                                            if {percent2.%player%} <= 50.99:
                                                                set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆▆"
                                                            else:
                                                                if {percent2.%player%} <= 55.99:
                                                                    set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆▆"
                                                                else:
                                                                    if {percent2.%player%} <= 60.99:
                                                                        set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆▆"
                                                                    else:
                                                                        if {percent2.%player%} <= 65.99:
                                                                            set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆▆"
                                                                        else:
                                                                            if {percent2.%player%} <= 70.99:
                                                                                set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆▆"
                                                                            else:
                                                                                if {percent2.%player%} <= 75.99:
                                                                                    set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆▆"
                                                                                else:
                                                                                    if {percent2.%player%} <= 80.99:
                                                                                        set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆▆"
                                                                                    else:
                                                                                        if {percent2.%player%} <= 85.99:
                                                                                            set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆▆"
                                                                                        else:
                                                                                            if {percent2.%player%} <= 90.99:
                                                                                                set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆▆"
                                                                                            else:
                                                                                                if {percent2.%player%} <= 99.99:
                                                                                                    set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆&7&l▆"
                                                                                                else:
                                                                                                    set {progress.%player%} to "&e&l▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆"                               
                        format slot {_slots} of player with a red stained glass pane named "&c&l/%{commands2::%loop-value%}%" with lore "||&6&l* &6&lPrice: &b&l$%{commandsprice2::%loop-value%}%||   &6&l- &eBalance: &7%{balance::%player%}%||   &6&l- &ePrice Per Use: &7$%{commandsppu2::%loop-value%}%||||&6&l* Percentage: &b&l%{percent2.%player%}%%%||%{progress.%player%}%||||&c&lLOCKED||&7You do not have enough money." to be unstealable
command /addcmd <text> <int> <text>:
    permission: owner.*
    trigger:
        add 1 to {cmds1}
        set {commands2::%arg-1%} to arg-1
        set {commandsprice2::%arg-1%} to arg-2
        set {commandsppu2::%arg-1%} to arg-3
        send "&a&l(!) &aCommand added: /%arg-1%"
        send "&aPrice: $%arg-2%"
        send "&aPrice Per Use: $%arg-3%"
 
Last edited:
Status
Not open for further replies.