Access to offline player's 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 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.

Kuzifes

Member
Apr 25, 2017
16
0
1
Can someone help me how I can access the inventory and the enderchest of an offline player?
 
so you could do this when the player leaves:
code_language.skript:
on quit:
      set {savedinventory::%player%} to serialized contents of player's current inventory (needs skquery)
      set {helm.%player%} to player's helmet
      set {boots.%player%} to player's boots
      set {chest.%player%} to player's chestplate
      set {leg.%player%} to player's leggings
to save their current inventory, and then on your command to display their inventory, reference these variables to set the slots
 
so you could do this when the player leaves:
code_language.skript:
on quit:
      set {savedinventory::%player%} to serialized contents of player's current inventory (needs skquery)
      set {helm.%player%} to player's helmet
      set {boots.%player%} to player's boots
      set {chest.%player%} to player's chestplate
      set {leg.%player%} to player's leggings
to save their current inventory, and then on your command to display their inventory, reference these variables to set the slots
Use a single list and serializied inventory hardly ever works and @OP read from player data files
 
Use a single list and serializied inventory hardly ever works and @OP read from player data files
I made an inventory change per WG region skript that switches you back to your original inventory on exit of the region this way and it works perfectly fine
 
I made an inventory change per WG region skript that switches you back to your original inventory on exit of the region this way and it works perfectly fine
Serialized inventory is prone to so many issues you shouldn't use it. If you use this, I'm sorry for your variables file
 
Serialized inventory is prone to so many issues you shouldn't use it. If you use this, I'm sorry for your variables file
Why don't you explain to him how to read from player data files then? I certainly don't know, and I'm sure he doesn't either since he's asking.
 
You could just use the following TuSKe's expression:
code_language.skript:
[the] player data of %offlineplayer%
%offlineplayer%'[s] player data
Then with the ender chest expression of Skript you would be able to access to the player's offline inventory. Also, if you don't know how to get an offline player object you would use the parse expression parsing the offline player name in this case.
 
  • Like
Reactions: Wynnevir
Status
Not open for further replies.