Help with custom playervault 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!

Status
Not open for further replies.

iChinchillinq

Member
May 11, 2018
10
0
0
Hello! I cannot find a way to fix my PlayerVaults skript, when there seems to be nothing wrong with it. I get no errors, and it worked perfectly before I added something on to a variable so that it is able to be used with multiple vaults. If anyone could help, I would appreciate it. Thanks!
code_language.skript:
on right click:
    if target block is an ender chest:
        cancel event
        open virtual chest inventory with size 6 named "&7Vaults (Page 1)" for player
        set {_n} to 0
        loop 25 times:
            if {_n} is 10 or 19 or 28 or 37:
                add 7 to {_n}
            format gui slot {_n} of player with black stained glass pane named "&f"
            add 1 to {_n}
        format gui slot 53 of player with paper named "&c&lNext »" to run function page2(player)
        set {_n} to 10
        set {_n2} to 1
        loop 28 times:
            if {_n} is 17 or 26 or 35:
                add 2 to {_n}
            format gui slot {_n} of player with ender chest named "&7Vault %{_n2}%" to run player command "/vault %{_n2}%"
            add 1 to {_n}
            add 1 to {_n2}

function page2(p: player):
    open virtual chest inventory with size 6 named "&7Vaults (Page 2)" for {_p}
    set {_n} to 0
    loop 25 times:
        if {_n} is 10 or 19 or 28 or 37:
            add 7 to {_n}
        format gui slot {_n} of {_p} with black stained glass pane named "&f"
        add 1 to {_n}
    set {_n} to 10
    set {_n2} to 29
    loop 28 times:
        if {_n} is 17 or 26 or 35:
            add 2 to {_n}
        format gui slot {_n} of {_p} with ender chest named "&7Vault %{_n2}%" to run {_p} command "/vault %{_n2}%"
        add 1 to {_n}
        add 1 to {_n2}
    format gui slot 53 of {_p} with paper named "&c&l« Back" to run function back({_p})

command /vault [<integer>]:
    trigger:
        if argument 1 is not set:
            send "&cIncorrect Usage."
        else:
            if player has the permission "vault.%arg-1%":
                open chest with 6 rows named "&7%player% &8- &7%arg-1%" to player
                set {_n} to 0
                loop 36 times:
                    add {bp::%player's UUID%::%{_n}%::%arg-1%} to the current inventory of player
                    add 1 to {_n}
                format gui slot 45 of player with paper named "&c&l« Back" to run function back(player)
                set {_n} to 45
                loop 8 times:
                    add 1 to {_n}
                    format gui slot {_n} of player with barrier named "&f"
                set {_n} to 36
                loop 9 times:
                    format gui slot {_n} of player with black stained glass pane named "&f"
                    add 1 to {_n}
            else:
                send "&cInsufficient Permissions."

function back(p: player):
    open virtual chest inventory with size 6 named "&7Vaults (Page 1)" for {_p}
    set {_n} to 0
    loop 25 times:
        if {_n} is 10 or 19 or 28 or 37:
            add 7 to {_n}
        format gui slot {_n} of {_p} with black stained glass pane named "&f"
        add 1 to {_n}
    format gui slot 53 of {_p} with paper named "&c&lNext »" to run function page2({_p})
    set {_n} to 10
    set {_n2} to 1
    loop 28 times:
        if {_n} is 17 or 26 or 35:
            add 2 to {_n}
        format gui slot {_n} of {_p} with ender chest named "&7Vault %{_n2}%" to run {_p} command "/vault %{_n2}%"
        add 1 to {_n}
        add 1 to {_n2}

on inventory close:
    if name of player's current inventory does not contain "%player%":
        stop
    else:
        loop 56 times:
            if name of player's current inventory is "%player% &8- %loop-value%":
                set {v.%player%} to loop-value
        loop 36 times:
            set {bp::%player's UUID%::%loop-number - 1%::%{v.%player%}%} to slot "%loop-number - 1%" parsed as an integer of current inventory of player
        delete {v.%player%}
The skript either doesn't set the variable of the item in the slot correctly, or doesn't add the item in the slot correctly.
[doublepost=1546462053,1545602178][/doublepost]Bump
 
Status
Not open for further replies.