player inventory

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

AngDrew

Member
Sep 23, 2017
14
0
0
25
how to store every item in player inventory (including its nbt, lore, name) to variables or mysql?
 
For variables i think you could do the following:
code_language.skript:
Something:
    set {slot} to 0
    loop 54 times:
        set {Item} to items in {slot} of player
        add {Item} to {Inv.%player%::*}
        add 1 to {slot}
and ... im not sure it will work :emoji_stuck_out_tongue:
 
thx btw
@HackerOTVW
[doublepost=1508858046,1508857812][/doublepost]
code_language.skript:
command /backup:
    trigger:
        set {_slot} to 0
        loop 54 times:
            set {_Item} to items in {_slot} of player
            add {_Item} to {Inv.%player%::*}
            add 1 to {_slot}

error: {_slot} of player is not an inventory (gago.sk, line 8: set {_Item} to items in {_slot} of player')
 
thx btw
@HackerOTVW
[doublepost=1508858046,1508857812][/doublepost]
code_language.skript:
command /backup:
    trigger:
        set {_slot} to 0
        loop 54 times:
            set {_Item} to items in {_slot} of player
            add {_Item} to {Inv.%player%::*}
            add 1 to {_slot}

error: {_slot} of player is not an inventory (gago.sk, line 8: set {_Item} to items in {_slot} of player')
Try:
code_language.skript:
command /inv [<string>]:
    trigger:
        if arg 1 is "backup":
            set {_slot} to 0
            loop 36 times:
                set {_Item.%{_slot}%.%player%} to items in slot {_slot} of player's inventory
                add 1 to {_slot}
        if arg 1 is "restore":
            set {_slot} to 0
            loop 36 times:
                set slot {_slot} of player's inventory to {_Item.%{_slot}%.%player%}
                add 1 to {_slot}
 
Status
Not open for further replies.