#need help with multiples arguments

1 messages · Page 1 of 1 (latest)

subtle meteor
#

in my code, if i type the command "/time" i should get the error message "Digite (add ou remove) but i get the usage of it, how do i fix this messages?

when i try to specify the arguments like "if argument 1 is not "add" or argument 1 is not "remove" i get another error, i honestly dont know what to do

#

i'm only using the skript plugin, no addons

vital marsh
#

Well if you run just /time the command wont run cause you don't have the arguments

subtle meteor
#

i will try to put them to be optional

#

the arguments

vital marsh
#

Also why you have stop in every condition?

#

Why not just make the other ones else ifs

subtle meteor
#

i dont like the structure of various ifs and elses

vital marsh
#

But you have it anyways

subtle meteor
#

yeah but its not indexed, i dont know how to explain

#

like

#

all of ifs are in the same indention

vital marsh
#
if arg-1. ......
else if arg-2 .....
#

Like if you ask me that looks much cleaner

subtle meteor
#

oh i see

#

let me see if i get it correctly

vital marsh
#

Literally just remove the stops
And add else before all ifs except the first one

subtle meteor
#

thats it?

vital marsh
#

Yes

subtle meteor
#

thats what i do not understand, the last argument is the wrong, right? there is no player called abcde, so why do i get the arg-2 error message

vital marsh
#

oh

#

tf

#

Can you send the code here

subtle meteor
#

sure

#

u want the file?

#

or writed

vital marsh
#

Yes

#

file

subtle meteor
#

ok

#

btw im brazilian, so you will find lots of portuguese messages

vital marsh
#

You sure you spelled defensores right?

#

Or reloaded the file

#

Bc it works for me

#

Wait no nvm

#

wtf

subtle meteor
#

yes i guess, i even reloaded the server

vital marsh
#

Oh ik whats wrong

#

Since the arg-3 is optional

#

and it wants a player

#

It will think arg-2 is defensores abcde

#

And not just defensores

subtle meteor
#

oh, the skript count empty spaces?

#

thats really bad

#

ok so, changing player to be needed, the error messages changes but does not show mine message, so the command wont run if player does not exist?

vital marsh
#

add set {_arg2::*} to arg-2 split at " " at very start before any conditions
Then just check {_arg2::1} instead of arg-2

vital marsh
#

It cuts the arg-2 where the space is

#

So {_arg2::1} will only be stuff before the space

vital marsh
subtle meteor
#

now it works

#

thats a very smart solution

#

u saved me hours of mind burning lol

#

im very new to skript, just using to have fun and program a minigame