%arg-1% not working 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 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.

PlebLord82

Member
Sep 14, 2020
4
0
1
23
hello,
so im making a /buykit [<kitname>] command where it opens a gui to buy the kit. every reload is successful, but its not working. i think ive isolated the problem to the %arg-1% in the {%player%.kit.%arg-1%} variables. so executing "/kit" gives the error message for that to the player, and doing /kit [random name] works with the respected error message, but doing "/kit [fighter, archer, fisherman, or scout]" does nothing. any help?
thanks in advance for any answers.
Code:
# buykit command
command /buykit [<text>]:
  permission: kits.buykit
  trigger:
    if arg-1 is not set:
      message "&c/buykit [kitname]" to player
    if arg-1 is set:
      if arg-1 is "fighter" or "archer" or "fisherman" or "scout":
        if {%player%.kit.%arg-1%} is 1:
          message "&cYou already own this kit" to player
        if {%player%.kit.%arg-1%} is 0:
          create a gui with id "%player%.buykit.%arg-1%" with virtual chest with 3 rows named "Buy Kit":
            format gui slot 4 with an wooden sword named "&aBuy kit: &f%arg-1% &afor &f$100&a?":
              cancel event
            format gui slot 11 with an emerald block named "&a&lBuy Kit":
              close player's inventory
              message "&aYou have bought kit &f%arg-1% &afor &f$100"
              set {%player%.kit.%arg-1%} to 1
            format gui slot 15 with an redstone block named "&c&lCancel":
              close player's inventory
            format gui slot 22 with an gold block named "&6Price: &f$100":
              cancel the event
          wait 1 tick
          open gui "%player%.buykit.%arg-1%" to player
      else:
        message "&cThat isn't a kit" to player
 
if this is all the code, you have no commands to give the player a kit. If you are using a custom skript command to give the player a kit, make the command "/usekit" or something, essentials might be interfering with the /kit command
 
if this is all the code, you have no commands to give the player a kit. If you are using a custom skript command to give the player a kit, make the command "/usekit" or something, essentials might be interfering with the /kit command
yeah so i already skripted all the kit commands and they work fine. i also don't have essentials.
 
If you want I can help you by discord to try the command on your server.
My discord: Mich7272#4464
 
Bruh.
You have to use the full variable name.
open gui "%player%.buykit.%arg-1%" to player = open gui "{%player%.buykit.%arg-1%}" to player
 
Status
Not open for further replies.