Solved AutoUpdate gui and some issues I need help to fix

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

KroterPvP

Active Member
Apr 10, 2017
178
7
18
22
code_language.skript:
            set {a.%player%} to 0
            open chest with 3 rows named " Manage your account balance" to player
            wait 1 tick
            format slot 0 of player with graywindowglass named "&7" to be unstealable
            format slot 1 of player with graywindowglass named "&7" to be unstealable
            format slot 2 of player with graywindowglass named "&7" to be unstealable
            format slot 3 of player with graywindowglass named "&7" to be unstealable
            format slot 4 of player with graywindowglass named "&7" to be unstealable
            format slot 5 of player with graywindowglass named "&7" to be unstealable
            format slot 6 of player with graywindowglass named "&7" to be unstealable
            format slot 7 of player with graywindowglass named "&7" to be unstealable
            format slot 8 of player with graywindowglass named "&7" to be unstealable
            format slot 9 of player with graywindowglass named "&7" to be unstealable
            format slot 10 of player with graywindowglass named "&7" to be unstealable
            format slot 11 of player with greenwindowglass named "&a+1 &7€" to run [add 1 to {a.%player%}]->[format slot 13 of player with skull of ("%player%" parsed as an offline player) named "&7" with lore "||&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€." to run [make player execute command "/seco withdraw %{a.%player%}%"]]
            format slot 12 of player with graywindowglass named "&7" to be unstealable
            format slot 13 of player with skull of ("%player%" parsed as an offline player) named "&7" with lore "||&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€." to run [make player execute command "/seco withdraw %{a.%player%}%"]
            format slot 14 of player with graywindowglass named "&7" to be unstealable
            format slot 15 of player with redwindowglass named "&c-1 &7€" to run [remove 1 from {a.%player%}]->[format slot 13 of player with skull of ("%player%" parsed as an offline player) named "&7" with lore "||&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€." to run [make player execute command "/seco withdraw %{a.%player%}%"]]
            format slot 16 of player with graywindowglass named "&7" to be unstealable
            format slot 17 of player with graywindowglass named "&7" to be unstealable
            format slot 18 of player with graywindowglass named "&7" to be unstealable
            format slot 19 of player with graywindowglass named "&7" to be unstealable
            format slot 20 of player with graywindowglass named "&7" to be unstealable
            format slot 21 of player with graywindowglass named "&7" to be unstealable
            format slot 22 of player with graywindowglass named "&7" to be unstealable
            format slot 23 of player with graywindowglass named "&7" to be unstealable
            format slot 24 of player with graywindowglass named "&7" to be unstealable
            format slot 25 of player with graywindowglass named "&7" to be unstealable
            format slot 26 of player with graywindowglass named "&7" to be unstealable
I need help with this part of code I've done. The menu is created correctly, but I have some issues:
1. If I click the slots that are drew in the image it runs the command of the skull. Why? How can I fix it?
KNxWdtU.png
2. The green glass adds 1 to the variable. The red one removes 1. The skull displays the player balance and the ammount to withdraw too. When you click the skull, it executes the command to withdraw from your balance. How can I make the gui to update automaticly every time I click one of the glasses? When you click the skull to confirm a withdraw, the skull doesn't update the balance variable, and the ammount to withdraw doesn't reset to 0. How can I fix all this issues?
 
1. This code is crap, because format slot will not support anymore. use tuske or umbaska. (If im correct)
2. Use While for update the inventory. like this, or refresh if he clicked on green glass

code_language.skript:
command /withdraw:
    trigger:
        set {a.%player%} to 0
        open chest with 3 rows named "&6Withdraw" to player
        loop 3*9 times:
            set slot loop-number -1 of player's current inventory to graywindowglass named "&r"
            if loop-number -1 is 11:
                set slot loop-number -1 of player's current inventory to green stained glass pane named "&a+1"
            else if loop-number -1 is 13:
                set slot loop-number -1 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."
            else if loop-number -1 is 15:
                set slot loop-number -1 of player's current inventory to red stained glass pane named "&c-1"
        while name of player's current inventory is "&6Withdraw":#!<=== Use the while ORRRR refresh when you clicked the green stained glass pane (Look On inventory click)
            wait 1 seconds
            set slot 13 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."
          
on inventory click:
    if name of player's current inventory is "&6Withdraw":
        if clicked slot is 11:
            add 1 to {a.%player%}
            #set slot 13 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."#!<=== maybe reduce lagg
        else if clicked slot is 15:
            remove 1 from {a.%player%}
            #set slot 13 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."#!<=== Maybe reduce laggs
        else if clicked slot is 13:
            if clicked type is "RIGHT_CLICK":
                #withdraw code
 
Or with TuSKe
code_language.skript:
function changeWithdrawed(amount: num, p: player):
    if {withdrawed::%{_p}%} > 0:
        send "&cCan't add money to your account !" to {_p}
    else:
        add {_amount} to {b::%{_player}%}
        format gui slot 13 of {_p} with {_p}'s skull named "&r" with lore "&7Your balance: &a%{seco.bal::%{_p}%}%&7€.||&7Rightclick to withdraw: &a%{withdrawed::%{_p}%}%&7€." to run function withdraw({_p})
        
function withdraw(p: player):
    remove {withdrawed::%{_p}%} from {seco.bal::%{_p}%}
    clear {withdrawed::%{_p}%}

command /withdraw:
    trigger:
        set {withdrawed::%player%} to 0
        set {_rows} to #>> number of rows here <<
        open virtual chest inventory with size {_rows} named "&6Withdraw" to player
        loop integers from 0 to ({_rows} * 9) - 1:
            if loop-number is 11:
                format gui slot 11 of player with green stained glass pane named "&a+1" to run function changeWithdrawed(1, player)
            else if loop-number is 13:
                format gui slot 13 of player with player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{withdrawed::%player%}%&7€." to run function withdraw(player)
            else if loop-num is 15:
                format gui slot 15 of player with red stained glass pane named "&c-1" to run function changeWithdrawed(-1, player)
            else:
                format gui slot loop-num of player with gray glass pane named "&r"
 
Thanks. I will try the best option.
[doublepost=1495996498,1495987870][/doublepost]
1. This code is crap, because format slot will not support anymore. use tuske or umbaska. (If im correct)
2. Use While for update the inventory. like this, or refresh if he clicked on green glass

code_language.skript:
command /withdraw:
    trigger:
        set {a.%player%} to 0
        open chest with 3 rows named "&6Withdraw" to player
        loop 3*9 times:
            set slot loop-number -1 of player's current inventory to graywindowglass named "&r"
            if loop-number -1 is 11:
                set slot loop-number -1 of player's current inventory to green stained glass pane named "&a+1"
            else if loop-number -1 is 13:
                set slot loop-number -1 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."
            else if loop-number -1 is 15:
                set slot loop-number -1 of player's current inventory to red stained glass pane named "&c-1"
        while name of player's current inventory is "&6Withdraw":#!<=== Use the while ORRRR refresh when you clicked the green stained glass pane (Look On inventory click)
            wait 1 seconds
            set slot 13 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."
         
on inventory click:
    if name of player's current inventory is "&6Withdraw":
        if clicked slot is 11:
            add 1 to {a.%player%}
            #set slot 13 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."#!<=== maybe reduce lagg
        else if clicked slot is 15:
            remove 1 from {a.%player%}
            #set slot 13 of player's current inventory to player's skull named "&r" with lore "&7Your balance: &a%{seco.bal::%player%}%&7€.||&7Rightclick to withdraw: &a%{a.%player%}%&7€."#!<=== Maybe reduce laggs
        else if clicked slot is 13:
            if clicked type is "RIGHT_CLICK":
                #withdraw code
Thanks :emoji_wink:

1. I have TuSKe installed and it doesn't reconize "if clicked slot is 11:". Which addon do I need? It's possible to do it without add-ons? Which code do I need to use instead?
2. Then, I have another issue. How can I make the items in the gui to be unstealable? Using the expression "to be unstealable" isn't reconized.
3. The variable "{a.%player%}" is displayed, but the variable for the money is displayed like "<none>".
 
The unstealable you need only put "cancel event" under "if name of player's current inventory is "...":" from inventory clicking
 
Last edited by a moderator:
His solution is from Skellett, mine is from TuSKe @KroterPvP. Also, why is it the "best solution" ?
I've marked his answer as "Best answer" because it runs well. Your code doesn't run well. It doesn't withdraw and it doesn't display the variable.
But thanks for helping
[doublepost=1495998985,1495997781][/doublepost]
The unstealable you need only put "cancel event" under "if name of player's current inventory is "...":" from inventory clicking
1. I have TuSKe installed and it doesn't reconize "if clicked slot is 11:". It's possible to do it without add-ons? Which code do I need to use instead?
 
Status
Not open for further replies.