Save chest

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

Vxnku

Member
Nov 29, 2022
15
0
1
23
Code:
command /backpack2:
    permission: op
    trigger:
        player has permission "op"
        open chest to player
        save chest
I want the chest to be saved when closing, and if possible, to have it for each player separately
 
Since skript doesn't allow for you to save specific inventories, you have to save the specific items inside of the inventory as a variable instead. Something like this should work:


Code:
command /backpack2:
    permission: op
    trigger:
        if {backpack::%uuid of player%::*} is set:
            open chest with 3 rows named "&8Backpack &7- &b%player%" to player
            set player's current inventory to {backpack::%uuid of player%::*}
            delete {backpack::%uuid of player%::*}
            stop
        open chest with 3 rows named "&8Backpack &7- &b%player%" to player
       
on inventory close:
    if name of event-inventory is "&8Backpack &7- &b%player%":
        loop all items in event-inventory:
            add loop-value to {backpack::%uuid of player%::*}
 
Since skript doesn't allow for you to save specific inventories, you have to save the specific items inside of the inventory as a variable instead. Something like this should work:


Code:
command /backpack2:
    permission: op
    trigger:
        if {backpack::%uuid of player%::*} is set:
            open chest with 3 rows named "&8Backpack &7- &b%player%" to player
            set player's current inventory to {backpack::%uuid of player%::*}
            delete {backpack::%uuid of player%::*}
            stop
        open chest with 3 rows named "&8Backpack &7- &b%player%" to player
      
on inventory close:
    if name of event-inventory is "&8Backpack &7- &b%player%":
        loop all items in event-inventory:
            add loop-value to {backpack::%uuid of player%::*}



Many thanks! It works and great
But I still don't understand how containers(arrays) work, and I want to write a command
/open backpack2 <player>
and how to insert open array arg-2
 
Status
Not open for further replies.