1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Modify existing command

Discussion in 'Skript' started by RoosSkywalker, Sep 10, 2022.

Thread Status:
Not open for further replies.
  1. RoosSkywalker

    RoosSkywalker Member

    Joined:
    Jul 16, 2022
    Messages:
    15
    Likes Received:
    0
    I use FactionsUUID and Lands, I want both to work together so I have been building a script to make it happen. However, when it comes to banning and kicking from factions I need to be able to target the second argument in the command and I do not know how to do that. All commands in this script are existing commands.

    Skript version 2.6.3 vanilla only.

    Code (Text):
    1. on command "/f ban":
    2.     make player execute command "/lands ban %arg-2%"
    3.  
    4. on command "/f kick":
    5.     make player execute command "/lands untrust %arg-2%"
    Produces the errors:
    Code (Text):
    1. [23:55:14 INFO]: [Skript] Reloading factionleave.sk...
    2. [23:55:14 INFO]: Line 8: (factionleave.sk)
    3. [23:55:14 INFO]:     The expression 'argument' can only be used within a command
    4. [23:55:14 INFO]:     Line: make player execute command "/lands ban %arg-2%"
    5. [23:55:14 INFO]:
    6. [23:55:14 INFO]: Line 11: (factionleave.sk)
    7. [23:55:14 INFO]:     The expression 'argument' can only be used within a command
    8. [23:55:14 INFO]:     Line: make player execute command "/lands untrust %arg-2%"
    9. [23:55:14 INFO]:
    10. [23:55:14 INFO]: [Skript] Encountered 2 errors while reloading factionleave.sk! (41ms)
    --- Double Post Merged, Sep 11, 2022, Original Post Date: Sep 10, 2022 ---
    This code returns kick RoosSkywalker as the second argument instead of the player name RoosSkywalker.
    Why?
    Code (Text):
    1. on command "/f kick":
    2.     set {arg-2} to arguments
    3.     # make player execute command "/lands untrust %arg-2%"
    4.     send "%{arg-2}%" to player
    EDIT:
    This code returns kick RoosSkywalker as value for argument 2 instead of the player name RoosSkywalker. Why? Changing the variable to argument 3 has the same value.

     
    #1 RoosSkywalker, Sep 11, 2022
    Last edited: Sep 11, 2022
  2. Best Answer:
    Post #4 by lotzy, Sep 12, 2022
  3. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    139
    Likes Received:
    22
    Because you are using 'on command' event, not the command registration syntax. Read the docs.
     
  4. RoosSkywalker

    RoosSkywalker Member

    Joined:
    Jul 16, 2022
    Messages:
    15
    Likes Received:
    0
    That's the point. I want to edit this existing command.
     
  5. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    139
    Likes Received:
    22
    You cant edit existing command. Best choice to make something what you want check API of plugin then use Skript-Reflect for handle needed events. Idk another variants.
     
  6. RoosSkywalker

    RoosSkywalker Member

    Joined:
    Jul 16, 2022
    Messages:
    15
    Likes Received:
    0
    Thank you. I will stop wasting my time doing the impossible then.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...