1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

player inventory

Discussion in 'Skript' started by AngDrew, Oct 22, 2017.

Thread Status:
Not open for further replies.
  1. AngDrew

    AngDrew Member

    Joined:
    Sep 23, 2017
    Messages:
    14
    Likes Received:
    0
    how to store every item in player inventory (including its nbt, lore, name) to variables or mysql?
     
  2. HackerOTVW

    HackerOTVW Well-Known Member

    Joined:
    Sep 10, 2017
    Messages:
    91
    Likes Received:
    1
    For variables i think you could do the following:
    Code (Skript):
    1. Something:
    2.     set {slot} to 0
    3.     loop 54 times:
    4.         set {Item} to items in {slot} of player
    5.         add {Item} to {Inv.%player%::*}
    6.         add 1 to {slot}
    and ... im not sure it will work :emoji_stuck_out_tongue:
     
  3. AngDrew

    AngDrew Member

    Joined:
    Sep 23, 2017
    Messages:
    14
    Likes Received:
    0
    thx btw
    @HackerOTVW
    --- Double Post Merged, Oct 24, 2017, Original Post Date: Oct 24, 2017 ---
    Code (Skript):
    1. command /backup:
    2.     trigger:
    3.         set {_slot} to 0
    4.         loop 54 times:
    5.             set {_Item} to items in {_slot} of player
    6.             add {_Item} to {Inv.%player%::*}
    7.             add 1 to {_slot}
    error: {_slot} of player is not an inventory (gago.sk, line 8: set {_Item} to items in {_slot} of player')
     
  4. HackerOTVW

    HackerOTVW Well-Known Member

    Joined:
    Sep 10, 2017
    Messages:
    91
    Likes Received:
    1
    Try:
    Code (Skript):
    1. command /inv [<string>]:
    2.     trigger:
    3.         if arg 1 is "backup":
    4.             set {_slot} to 0
    5.             loop 36 times:
    6.                 set {_Item.%{_slot}%.%player%} to items in slot {_slot} of player's inventory
    7.                 add 1 to {_slot}
    8.         if arg 1 is "restore":
    9.             set {_slot} to 0
    10.             loop 36 times:
    11.                 set slot {_slot} of player's inventory to {_Item.%{_slot}%.%player%}
    12.                 add 1 to {_slot}
    13.  
     
Thread Status:
Not open for further replies.
Loading...