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 Use arg-1 two times in two different event

Discussion in 'Skript' started by iamhuneey, Dec 12, 2020.

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

    iamhuneey New Member

    Joined:
    Dec 12, 2020
    Messages:
    6
    Likes Received:
    0
    Hey, can you guys show me how do I use the arg-1 two times in two different event? Here is my code.
    So I want to use the arg-1 in a different event, but it isn't work. Can you write an example? This is just a test skript btw.


    Code (Text):
    1.  
    2.  
    3. options:
    4.     item: stick named "&cTest"
    5.  
    6. command /test <player>:
    7.     description: Testing...
    8.     trigger:
    9.         if arg-1 is online:
    10.             message "Testing %arg-1%"
    11.         give player {@item}
    12.         message "U got a stick"
    13.         execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
    14.  
    15. on right click with a stick:
    16.     message "test"
    17.     execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"


     
  2. Best Answer:
    Post #6 by Leonardo_, Dec 12, 2020
  3. Leonardo_

    Leonardo_ Member

    Joined:
    Sep 21, 2020
    Messages:
    18
    Likes Received:
    0
    Try this:

    Code (Text):
    1. options:
    2.     item: stick named "&cTest"
    3.  
    4. command /test <player>:
    5.     description: Testing...
    6.     trigger:
    7.         if arg-1 is online:
    8.             message "Testing %arg-1%"
    9.         set {arg1} to arg 1
    10.         give player {@item}
    11.         message "U got a stick"
    12.         execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
    13.  
    14. on right click with a stick:
    15.     message "test"
    16.     execute console command "execute at {arg1} run setworldspawn ~ ~ ~"
     
  4. iamhuneey

    iamhuneey New Member

    Joined:
    Dec 12, 2020
    Messages:
    6
    Likes Received:
    0
    It seems like doesn't work. Here is the console message:

    Invalid name or UUID

    ...xecute at {arg1} run setworldspawn ~ ~ ~<--[HERE]

     
  5. Leonardo_

    Leonardo_ Member

    Joined:
    Sep 21, 2020
    Messages:
    18
    Likes Received:
    0
    Because arg-1 isn't an online player.

    Try this:

    Code (Text):
    1. options:
    2.     item: stick named "&cTest"
    3.  
    4. command /test <player>:
    5.     description: Testing...
    6.     trigger:
    7.         if arg-1 is online:
    8.             message "Testing %arg-1%"
    9.             set {arg1::*} to arg 1
    10.             give player {@item}
    11.             message "U got a stick"
    12.             execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
    13.  
    14. on right click with a stick:
    15.     message "test"
    16.     execute console command "execute at {arg1::*} run setworldspawn ~ ~ ~"
     
  6. iamhuneey

    iamhuneey New Member

    Joined:
    Dec 12, 2020
    Messages:
    6
    Likes Received:
    0
    upload_2020-12-12_20-37-11.png

    again... here is a screenshot. I forgot to say that I have 1.16 skript
     
    #5 iamhuneey, Dec 12, 2020
    Last edited: Dec 12, 2020
  7. Leonardo_

    Leonardo_ Member

    Joined:
    Sep 21, 2020
    Messages:
    18
    Likes Received:
    0
    This works, pardon
    Code (Text):
    1. options:
    2.     item: stick named "&cTest"
    3.  
    4. command /test <player>:
    5.     description: Testing...
    6.     trigger:
    7.         if arg-1 is online:
    8.             message "Testing %arg-1%"
    9.             set {arg1::*} to arg 1
    10.             give player {@item}
    11.             message "U got a stick"
    12.             execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
    13.  
    14. on right click with a stick:
    15.     message "test"
    16.     execute console command "execute at %{arg1::*}% run setworldspawn ~ ~ ~"
     
  8. iamhuneey

    iamhuneey New Member

    Joined:
    Dec 12, 2020
    Messages:
    6
    Likes Received:
    0

    thank you so much
     
  9. acai

    acai Active Member

    Joined:
    Oct 23, 2020
    Messages:
    89
    Likes Received:
    1
    Set the argument to a variable!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...