Jump to content

Skript command arguments


Recommended Posts

So I want to make the command /ad, and I'm using this:

command /ad [<text>]

This code works, but I need the server ip AND the custom message.

So I tried using this:

command /ad [<text>] [<text>]

The first [<text>] holds the text for the server ip. The second one holds the custom message. But since they are both text arguments, I cant use %arg-text% because skript wont know which one I'm talking about. How would I make 2 text arguments for 1 command?

Link to comment
Share on other sites

command /ad [<text>] [<text>]:
        if arg-1 and arg-2 is set:
            broadcast "&5[AD] &7%player%&f: IP: %arg-1% &7- &fInfo: %arg-2%"
            send "&cInvalid arguments!" to executor

you can use arg-1, arg-2, etc. to determine which argument you want to use.

Link to comment
Share on other sites

You might want to make the second argument a string and not text type. I’m not sure, but every time I’ve done something similar, I have always made the last argument a string. 

Owner of oldgaffle.minehut.gg. (my paintball server)

Owner of karted.minehut.gg. (my mario kart server)

Advocate of individual freedom, especially freedom of speech.

Cooler than Stalemate128.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...