Solved arg-1 in command

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

Shap1n

Member
Jan 10, 2025
15
1
3
My skript doesnt work because arg-1 cant be used in a make player execute command, please help me fix it and send suggestions how to make it work please!



command /helper [<player>]:
permission: hmenu.helper
aliases: /h , /hmenu
trigger:
if arg-1 is set:
set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
set slot 15 of {_gui} to bell named "&e&lWARN"
else:
set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
set slot 12 of {_gui} to barrier named "&7&LVANISH"
set slot 14 of {_gui} to feather named "&f&lFLY"
on inventory click:
if name of event-slot = "&7&LVANISH":
make console execute command "/vanish %player%"
on inventory click:
if name of event-slot = "&f&lFLY":
make console execute command "/fly %player%"

on inventory click:
if name of event-slot = "&9&lTEMPMUTE":
close player's inventory
wait 2 ticks
make player execute command "/tm %arg-1%"

on inventory click:
if name of event-inventory = "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event
on inventory click:
if name of event-inventory = "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event
 
Actually, the reason why it doesn't work is because there are no arguments for an on inventory click event.

you would have to use a global variable for what you're trying to do.
 
  • Like
Reactions: HeliumBoi
My skript doesnt work because arg-1 cant be used in a make player execute command, please help me fix it and send suggestions how to make it work please!



command /helper [<player>]:
permission: hmenu.helper
aliases: /h , /hmenu
trigger:
if arg-1 is set:
set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
set slot 15 of {_gui} to bell named "&e&lWARN"
else:
set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
set slot 12 of {_gui} to barrier named "&7&LVANISH"
set slot 14 of {_gui} to feather named "&f&lFLY"
on inventory click:
if name of event-slot = "&7&LVANISH":
make console execute command "/vanish %player%"
on inventory click:
if name of event-slot = "&f&lFLY":
make console execute command "/fly %player%"

on inventory click:
if name of event-slot = "&9&lTEMPMUTE":
close player's inventory
wait 2 ticks
make player execute command "/tm %arg-1%"

on inventory click:
if name of event-inventory = "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event
on inventory click:
if name of event-inventory = "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event
Well obviously you can't use arg-1 in "on inventory click" event. You need to use %player% instead.

But problem i see is, you're trying to temporarily mute the player you clicked on (correct me if im wrong, im on mobile so i didnt really read everything), but if that's the case, you should loop the players or either extract the name of the player from the item you clicked from. (Also by saving the Arg-1's username to a variable)

If so, I can re-write your code so that it works the way that you intended. Could I?
 
Last edited:
  • Like
Reactions: Doodle
Well obviously you can't use arg-1 in "on inventory click" event. You need to use %player% instead.

But problem i see is, you're trying to temporarily mute the player you clicked on (correct me if im wrong, im on mobile so i didnt really read everything), but if that's the case, you should loop the players or either extract the name of the player from the item you clicked from. (Also by saving the Arg-1's username to a variable)

If so, I can re-write your code so that it works the way that you intended. Could I?
yes please, since I dont really know how to save it into a variable :emoji_grinning:
 
So this is the best it gets from what you provided me with. Hope you like it!


CSS:
command /helper [<player>]:
    permission: hmenu.helper
    aliases: /h, /hmenu
    trigger:
        if arg-1 is set:
            set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
            set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
            set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
            set slot 15 of {_gui} to bell named "&e&lWARN"
            set {h.m.p.u::%player's uuid%} to arg-1
            open {_gui} to player
        else:
            set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot 12 of {_gui} to barrier named "&7&LVANISH"
            set slot 14 of {_gui} to feather named "&f&lFLY"
            open {_gui} to player

on inventory click:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        cancel event

    if name of event-slot = "&7&LVANISH":
        make console execute command "/vanish %player%"

    else if name of event-slot = "&f&lFLY":
        make console execute command "/fly %player%"

    else if name of event-slot = "&9&lTEMPMUTE":
        close player's inventory
        wait 2 ticks
        if {h.m.p.u::%player's uuid%} is set:
            make player execute command "/tm %{h.m.p.u::%player's uuid%}%"

on inventory close:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        if {h.m.p.u::%player's uuid%} is set:
            delete {h.m.p.u::%player's uuid%}

WHAT CHANGES DID I MAKE?
- Changed the way you were trying to put the glasses.
- Changed the logic of "inventory click" (Always best to keep them all in 1 and not scatter them!)
- Set up the GUI before opening it to the player so it doesn't lag and cause duping problems.
- Stored the player username into a specified UUID-based variable and later deleted it so that it doesn't take up space.
* You didn't really need to go from 0 to 53 in a 3-row inventory, considering it only has 27 slots.

I'd suggest adding hex codes, symbols, sounds, and custom effects to make the best of it. And if you want, i can help you with that as well! Feel free to reach out. My Discord is: @temer_lang
 
Last edited:
So this is the best it gets from what you provided me with. Hope you like it!


CSS:
command /helper [<player>]:
    permission: hmenu.helper
    aliases: /h, /hmenu
    trigger:
        if arg-1 is set:
            set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
            set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
            set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
            set slot 15 of {_gui} to bell named "&e&lWARN"
            set {h.m.p.u::%player's uuid%} to arg-1
            open {_gui} to player
        else:
            set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot 12 of {_gui} to barrier named "&7&LVANISH"
            set slot 14 of {_gui} to feather named "&f&lFLY"
            open {_gui} to player

on inventory click:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        cancel event

    if name of event-slot = "&7&LVANISH":
        make console execute command "/vanish %player%"

    else if name of event-slot = "&f&lFLY":
        make console execute command "/fly %player%"

    else if name of event-slot = "&9&lTEMPMUTE":
        close player's inventory
        wait 2 ticks
        if {h.m.p.u::%player's uuid%} is set:
            make player execute command "/tm %{h.m.p.u::%player's uuid%}%"

on inventory close:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        if {h.m.p.u::%player's uuid%} is set:
            delete {h.m.p.u::%player's uuid%}

WHAT CHANGES DID I MAKE?
- Changed the way you were trying to put the glasses.
- Changed the logic of "inventory click" (Always best to keep them all in 1 and not scatter them!)
- Set up the GUI before opening it to the player so it doesn't lag and cause duping problems.
- Stored the player username into a specified UUID-based variable and later deleted it so that it doesn't take up space.
* You didn't really need to go from 0 to 53 in a 3-row inventory, considering it only has 27 slots.

I'd suggest adding hex codes, symbols, sounds, and custom effects to make the best of it. And if you want, i can help you with that as well! Feel free to reach out. My Discord is: @temer_lang
thank you so much! I understand it now it was much easier than I thought!
 
So this is the best it gets from what you provided me with. Hope you like it!


CSS:
command /helper [<player>]:
    permission: hmenu.helper
    aliases: /h, /hmenu
    trigger:
        if arg-1 is set:
            set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
            set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
            set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
            set slot 15 of {_gui} to bell named "&e&lWARN"
            set {h.m.p.u::%player's uuid%} to arg-1
            open {_gui} to player
        else:
            set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot 12 of {_gui} to barrier named "&7&LVANISH"
            set slot 14 of {_gui} to feather named "&f&lFLY"
            open {_gui} to player

on inventory click:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        cancel event

    if name of event-slot = "&7&LVANISH":
        make console execute command "/vanish %player%"

    else if name of event-slot = "&f&lFLY":
        make console execute command "/fly %player%"

    else if name of event-slot = "&9&lTEMPMUTE":
        close player's inventory
        wait 2 ticks
        if {h.m.p.u::%player's uuid%} is set:
            make player execute command "/tm %{h.m.p.u::%player's uuid%}%"

on inventory close:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        if {h.m.p.u::%player's uuid%} is set:
            delete {h.m.p.u::%player's uuid%}

WHAT CHANGES DID I MAKE?
- Changed the way you were trying to put the glasses.
- Changed the logic of "inventory click" (Always best to keep them all in 1 and not scatter them!)
- Set up the GUI before opening it to the player so it doesn't lag and cause duping problems.
- Stored the player username into a specified UUID-based variable and later deleted it so that it doesn't take up space.
* You didn't really need to go from 0 to 53 in a 3-row inventory, considering it only has 27 slots.

I'd suggest adding hex codes, symbols, sounds, and custom effects to make the best of it. And if you want, i can help you with that as well! Feel free to reach out. My Discord is: @temer_lang
hi I got another problem

on inventory click:
if name of event-slot = "&E&LWARN":
close player's inventory
wait 2 ticks
make console execute command "/wmq {h.m.p.u::%player's uuid%}"

It doesnt work and doesnt type the command
 
hi I got another problem

on inventory click:
if name of event-slot = "&E&LWARN":
close player's inventory
wait 2 ticks
make console execute command "/wmq {h.m.p.u::%player's uuid%}"

It doesnt work and doesnt type the command
okay I managed to fix that but the variable I set to the argument isnt working on my other command, please help me

command /helper [<player>]:
permission: hmenu.helper
aliases: /h , /hmenu
trigger:
if arg-1 is set:
set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
set slot 15 of {_gui} to bell named "&E&LWARN"
set {hmenu::name} to arg-1
else:
set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
set slot 12 of {_gui} to barrier named "&7&LVANISH"
set slot 14 of {_gui} to feather named "&f&lFLY"
on inventory click:
if name of event-slot = "&7&LVANISH":
make console execute command "/vanish %player%"
on inventory click:
if name of event-slot = "&f&lFLY":
make console execute command "/fly %player%"
on inventory click:
if name of event-slot = "&E&LWARN":
close player's inventory
wait 2 ticks
make player execute command "/wmm {hmenu::name}"
on inventory click:
if name of event-slot = "&9&lTEMPMUTE":
close player's inventory
wait 2 ticks
make player execute command "/tmm {hmenu::name}"
on inventory click:
if name of event-inventory = "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event
on inventory click:
if name of event-inventory = "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event
 
I tried your method but it doesnt work very well do you have any other ideas?
1753284013738.png

So this is the best it gets from what you provided me with. Hope you like it!


CSS:
command /helper [<player>]:
    permission: hmenu.helper
    aliases: /h, /hmenu
    trigger:
        if arg-1 is set:
            set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
            set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
            set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
            set slot 15 of {_gui} to bell named "&e&lWARN"
            set {h.m.p.u::%player's uuid%} to arg-1
            open {_gui} to player
        else:
            set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot (integers between 0 and 27) of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
            set slot 12 of {_gui} to barrier named "&7&LVANISH"
            set slot 14 of {_gui} to feather named "&f&lFLY"
            open {_gui} to player

on inventory click:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        cancel event

    if name of event-slot = "&7&LVANISH":
        make console execute command "/vanish %player%"

    else if name of event-slot = "&f&lFLY":
        make console execute command "/fly %player%"

    else if name of event-slot = "&9&lTEMPMUTE":
        close player's inventory
        wait 2 ticks
        if {h.m.p.u::%player's uuid%} is set:
            make player execute command "/tm %{h.m.p.u::%player's uuid%}%"

on inventory close:
    if name of event-inventory contains "ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
        if {h.m.p.u::%player's uuid%} is set:
            delete {h.m.p.u::%player's uuid%}

WHAT CHANGES DID I MAKE?
- Changed the way you were trying to put the glasses.
- Changed the logic of "inventory click" (Always best to keep them all in 1 and not scatter them!)
- Set up the GUI before opening it to the player so it doesn't lag and cause duping problems.
- Stored the player username into a specified UUID-based variable and later deleted it so that it doesn't take up space.
* You didn't really need to go from 0 to 53 in a 3-row inventory, considering it only has 27 slots.

I'd suggest adding hex codes, symbols, sounds, and custom effects to make the best of it. And if you want, i can help you with that as well! Feel free to reach out. My Discord is: @temer_lang
 
okay I managed to fix that but the variable I set to the argument isnt working on my other command, please help me

command /helper [<player>]:
permission: hmenu.helper
aliases: /h , /hmenu
trigger:
if arg-1 is set:
set {_gui} to a new chest inventory with 3 rows named "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to yellow_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ꜰᴏᴄᴜꜱᴇᴅ ᴏɴ: &f&n%arg-1%"
set slot 4 of {_gui} to skull of ("%arg-1%" parsed as offline player) named "&c&n%arg-1%"
set slot 11 of {_gui} to name_tag named "&9&lTEMPMUTE"
set slot 15 of {_gui} to bell named "&E&LWARN"
set {hmenu::name} to arg-1
else:
set {_gui} to a new chest inventory with 3 rows named "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
open {_gui} to player
set slot 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52 and 53 of {_gui} to lime_stained_glass_pane named "&7ᴄᴜʀʀᴇɴᴛʟʏ ɪɴ &f&nʏᴏᴜʀ&7 ʜᴇʟᴘᴇʀ ᴍᴇɴᴜ"
set slot 12 of {_gui} to barrier named "&7&LVANISH"
set slot 14 of {_gui} to feather named "&f&lFLY"
on inventory click:
if name of event-slot = "&7&LVANISH":
make console execute command "/vanish %player%"
on inventory click:
if name of event-slot = "&f&lFLY":
make console execute command "/fly %player%"
on inventory click:
if name of event-slot = "&E&LWARN":
close player's inventory
wait 2 ticks
make player execute command "/wmm {hmenu::name}"
on inventory click:
if name of event-slot = "&9&lTEMPMUTE":
close player's inventory
wait 2 ticks
make player execute command "/tmm {hmenu::name}"
on inventory click:
if name of event-inventory = "&eʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event
on inventory click:
if name of event-inventory = "&aʜᴇʟᴘᴇʀ ᴍᴇɴᴜ":
cancel event

That's not how this works. Don't simply apply my code to yours; your code has been enhanced by my input. You should use my code instead. It's working perfectly on my server.
 
That's not how this works. Don't simply apply my code to yours; your code has been enhanced by my input. You should use my code instead. It's working perfectly on my server.
did we both do the same reply at the same time lol