Block specific part of command

  • 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 community!

    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.

brandipity

New Member
Jun 4, 2019
7
0
0
Hey guys, I need your help here:

I'm trying to block the last portion of /spawnmob from working.

So /spawnmob creeper 1 (playername). I do NOT want (playername) to work.

I've tried a lot of things, none work.

Here's my most recent attempt:

on command "/spawnmob":
loop all players:
add loop player to {_list::*}
set {_list::*} to arguments
if command contains {_list::1}:
cancel event


What am I doing wrong? Any help is majorly appreciated!
 
Hey guys, I need your help here:

I'm trying to block the last portion of /spawnmob from working.

So /spawnmob creeper 1 (playername). I do NOT want (playername) to work.

I've tried a lot of things, none work.

Here's my most recent attempt:

on command "/spawnmob":
loop all players:
add loop player to {_list::*}
set {_list::*} to arguments
if command contains {_list::1}:
cancel event


What am I doing wrong? Any help is majorly appreciated!
Check for the size of the arguments to see if it's greater than 2
 
Thanks for the reply!

I’ve tried to use arguments with on command before and it doesn’t work.

It always tells me “arguments can only be used with command”.

How do I work around this?
 
Thanks for the reply!

I’ve tried to use arguments with on command before and it doesn’t work.

It always tells me “arguments can only be used with command”.

How do I work around this?
Can you send the code you used there?
 
Can you send the code you used there?

Unfortunately I can’t get to my laptop currently, but it went something like this:

on command “/spawnmob [<text>] [<text>] [<player>]”

if arg-3 is set:
cancel event

Something a bit like that.
 
Unfortunately I can’t get to my laptop currently, but it went something like this:

on command “/spawnmob [<text>] [<text>] [<player>]”

if arg-3 is set:
cancel event

Something a bit like that.
You shouldn't put the [<text>] stuff in there, they won't work since it's on command, not an actual command. You also can't use arg-3, you have to use size of arguments. You might have to split arguments at every space tho, I'm not sure.
 
You shouldn't put the [<text>] stuff in there, they won't work since it's on command, not an actual command. You also can't use arg-3, you have to use size of arguments. You might have to split arguments at every space tho, I'm not sure.

Can I count the number of characters in a command? There should only be two spaces. If someone runs it with three then obviously (player) is being added? How would I do this in code? I’m really new to Skript lol
 
Thanks for the link! Hadn’t seen that yet.

I’m still confused though, I don’t really need to join them do I? Is there just a way to count the number of a certain character? I have no idea how to implement any of that info.

Sorry for being such a nub
 
Thanks for the link! Hadn’t seen that yet.

I’m still confused though, I don’t really need to join them do I? Is there just a way to count the number of a certain character? I have no idea how to implement any of that info.

Sorry for being such a nub
You have to use the split feature; there are 3 lines, use the second. That will turn the string into a list. If the size of that list > 2, it has a third argument.
 
You have to use the split feature; there are 3 lines, use the second. That will turn the string into a list. If the size of that list > 2, it has a third argument.
Oh okay, that makes sense. What would the name of the list be? How do I use an operand to check if it’s greater than 2?

Thank you so much for all your help!
 
Status
Not open for further replies.