Open Inventory - Armor

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

ArthurMorgan

New Member
Dec 1, 2020
6
0
1
25
Hello, I am trying to make a command that opens a GUI of arg-1's armor, but I want it so when I click on the armor inside the GUI, arg-1's armor gets removed. I am getting errors though.

Skript:

command /viewarmor <player>:
trigger:
set {_viewarmor_} to a new chest inventory with 1 row with name "&cPlayer's Armor"
open {_viewarmor_} to player
set slot 0 of {_viewarmor_} to arg-1's helmet
on inventory click:
if name of event-inventory is "&cPlayer's Armor":
set arg-1's helmet to air

Errors: The expression 'argument' can only be used within a command (inventory.sk, line 9: set arg-1's helmet to air)

Please type the correct skript if you know.
[doublepost=1609191954,1609190135][/doublepost]I'm also having trouble giving the player armor through the GUI
 
Hey ArthurMorgan,
This works fine:
Code:
command /viewarmor [<offlineplayer>]:
    trigger:
        if arg-1 is not set:
            send "&cUsage: /viewarmor <player>" to player
        if arg-1 is set:
            set {_viewarmor} to a new chest inventory with 1 row named "&cPlayer's Armor"
            set {user} to arg-1
            wait 1 tick
            open {_viewarmor} to player
            set slot 0 of {_viewarmor} to arg-1's helmet

on inventory click:
    if inventory name of current inventory of player is "&cPlayer's Armor":
        clicked slot is 0:
            set {user}'s helmet to air
Dont forget to add Skellett otherwise it won't work. Version I used: 1.9.11
 
Just wanted to put this in here as well in case someone else finds it. This works for me to create a menu where you can take off your armor and will not allow you to mess with any of the other slots in the given menu (or put it back on once removed). I used a portion of the given script and changed it to my needs.

command /viewarmor [<offlineplayer>]:
trigger:
if arg-1 is not set:
send "&cUsage: /viewarmor <player>" to player
if arg-1 is set:
set {_viewarmor::%player's uuid%} to a new chest inventory with 1 row named "&cPlayer's Armor"
set {user} to arg-1
wait 1 tick
open {_viewarmor::%player's uuid%} to player
set slot 0 of {_viewarmor::%player's uuid%} to arg-1's helmet
set slot 1 of {_viewarmor::%player's uuid%} to arg-1's chestplate
set slot 2 of {_viewarmor::%player's uuid%} to arg-1's leggings
set slot 3 of {_viewarmor::%player's uuid%} to arg-1's boots
set slot 4 of {_viewarmor::%player's uuid%} to red stained glass pane
set slot 5 of {_viewarmor::%player's uuid%} to red stained glass pane
set slot 6 of {_viewarmor::%player's uuid%} to red stained glass pane
set slot 7 of {_viewarmor::%player's uuid%} to red stained glass pane
set slot 8 of {_viewarmor::%player's uuid%} to red stained glass pane
if slot 0 of open inventory is not a helmet:
set slot 0 of open inventory to red stained glass pane
if slot 1 of open inventory is not a chestplate:
set slot 1 of open inventory to red stained glass pane
if slot 2 of open inventory is not leggings:
set slot 2 of open inventory to red stained glass pane
if slot 3 of open inventory is not boots:
set slot 3 of open inventory to red stained glass pane

on inventory click:
if name of open inventory is "&cPlayer's Armor":
if clicked item is red stained glass pane:
cancel event
clicked slot is 0:
set {user}'s helmet to air
wait 2 ticks
set slot 0 of open inventory to red stained glass pane
clicked slot is 1:
set {user}'s chestplate to air
wait 2 ticks
set slot 1 of open inventory to red stained glass pane
clicked slot is 2:
set {user}'s leggings to air
wait 2 ticks
set slot 2 of open inventory to red stained glass pane
clicked slot is 3:
set {user}'s boots to air
wait 2 ticks
set slot 3 of open inventory to red stained glass pane
if clicked item is red stained glass pane:
cancel event


Sorry for the sloppy code input in here, haven't submitted this stuff before, but just trying to be helpful. You'll have to re indent it, unless I find how to upload the code itself, but hopefully this helps anyone else who finds this.
 
Last edited:
Status
Not open for further replies.