Solved Use arg-1 two times in two different event

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

iamhuneey

New Member
Dec 12, 2020
6
0
1
26
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:
options:
    item: stick named "&cTest"
  
command /test <player>:
    description: Testing...
    trigger:
        if arg-1 is online:
            message "Testing %arg-1%"
        give player {@item}
        message "U got a stick"
        execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"

on right click with a stick:
    message "test"
    execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
 
Try this:

Code:
options:
    item: stick named "&cTest"
 
command /test <player>:
    description: Testing...
    trigger:
        if arg-1 is online:
            message "Testing %arg-1%"
        set {arg1} to arg 1
        give player {@item}
        message "U got a stick"
        execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
 
on right click with a stick:
    message "test"
    execute console command "execute at {arg1} run setworldspawn ~ ~ ~"
 
Try this:

Code:
options:
    item: stick named "&cTest"
 
command /test <player>:
    description: Testing...
    trigger:
        if arg-1 is online:
            message "Testing %arg-1%"
        set {arg1} to arg 1
        give player {@item}
        message "U got a stick"
        execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
 
on right click with a stick:
    message "test"
    execute console command "execute at {arg1} run setworldspawn ~ ~ ~"

It seems like doesn't work. Here is the console message:

Invalid name or UUID

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

 
It seems like doesn't work. Here is the console message:

Invalid name or UUID

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

Because arg-1 isn't an online player.

Try this:

Code:
options:
    item: stick named "&cTest"
 
command /test <player>:
    description: Testing...
    trigger:
        if arg-1 is online:
            message "Testing %arg-1%"
            set {arg1::*} to arg 1
            give player {@item}
            message "U got a stick"
            execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
 
on right click with a stick:
    message "test"
    execute console command "execute at {arg1::*} run setworldspawn ~ ~ ~"
 
upload_2020-12-12_20-37-11.png


again... here is a screenshot. I forgot to say that I have 1.16 skript
 
Last edited:
This works, pardon
Code:
options:
    item: stick named "&cTest"
 
command /test <player>:
    description: Testing...
    trigger:
        if arg-1 is online:
            message "Testing %arg-1%"
            set {arg1::*} to arg 1
            give player {@item}
            message "U got a stick"
            execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
 
on right click with a stick:
    message "test"
    execute console command "execute at %{arg1::*}% run setworldspawn ~ ~ ~"
View attachment 5551

again... here is a screenshot. I forgot to say that I have 1.16 skript
 
This works, pardon
Code:
options:
    item: stick named "&cTest"
 
command /test <player>:
    description: Testing...
    trigger:
        if arg-1 is online:
            message "Testing %arg-1%"
            set {arg1::*} to arg 1
            give player {@item}
            message "U got a stick"
            execute console command "execute at %arg-1% run setworldspawn ~ ~ ~"
 
on right click with a stick:
    message "test"
    execute console command "execute at %{arg1::*}% run setworldspawn ~ ~ ~"


thank you so much
 
Status
Not open for further replies.