Player Inventory Empty

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

LoneElf

Active Member
Apr 30, 2017
165
2
18
Hi - So, this should be very easy, but for one weird thing: When I do /test, it checks if the player's inventory is empty. So, which mine is, for some reason it says it isn't. I checked by if it is empty, messaging the player "hi", and if it isn't, message the player bye, and I did /clear LoneElf, and when I did it, it messaged me "bye". I checked my armour slots and it is also cleared. Thanks guys - LoneElf
 
Doing something like this:
code_language.skript:
if player's inventory is empty:
    message "Empty!" to player
seems to work fine for me.

From experience, I know the is empty expression can sometimes be annoying to work with, so here's some alternatives:

Using a list, but still avoiding is empty:
code_language.skript:
set {_test::*} to items of inventory of player
if "%{_test::*}%" is "<none>":
    message "Empty!" to player

Using the can hold expression:
code_language.skript:
if player can hold 2304 portal:
    message "Empty!" to player

Hope this helps
 
Thanks man! The can hold 2304 portal worked for me! Thanks bro for all of your help! :emoji_slight_smile:
 
Doing something like this:
code_language.skript:
if player's inventory is empty:
    message "Empty!" to player
seems to work fine for me.

From experience, I know the is empty expression can sometimes be annoying to work with, so here's some alternatives:

Using a list, but still avoiding is empty:
code_language.skript:
set {_test::*} to items of inventory of player
if "%{_test::*}%" is "<none>":
    message "Empty!" to player

Using the can hold expression:
code_language.skript:
if player can hold 2304 portal:
    message "Empty!" to player

Hope this helps
Or simple and reliable:
code_language.skript:
if items in player's inventory is not set:
 
xD Thanks man :emoji_slight_smile:
[doublepost=1499230377,1499029099][/doublepost]So, I didn't bother making a new thread for this question, but none of those up there check the armor slots - I really need it to check the armor slots because I am making a kit skript and I need it to make sure that the player's armor isn't on because I don't want the armor to vanish. Thanks guys! :emoji_slight_smile:
[doublepost=1499265677][/doublepost]So, I found something out - I can do something like this: if player's helmet is empty: do something - The thing is, I need that to work all in one code for all pieces. Like this: if player's armour slots are empty: do something
 
code_language.skript:
if player's helmet and player's chestplate and player's leggings and player's boots is empty:
    #do stuff
 
Status
Not open for further replies.