Skript option variables multiple value

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

Tinkot

Active Member
Feb 10, 2018
57
1
0
27
Hey, I am designing a minigames system on my server and i want to block some commands at a certain point. I want to set the blocked commands with option variables.



i want something like this
code_language.skript:
options:
    Commands: tpa, spawn, back


on command:
    set {_counter} to 1
    loop {@Commands::*}:
        if command is {@Commands::%{_counter}%}
            cancel event
            message "Haha this command is blocked"
            stop loop
        add 1 to {_counter}

Is it possible?
 
That way won't work, because your option:commands is not a variable list
You could try something like setting the commands into your variable list
 
That way won't work, because your option:commands is not a variable list
You could try something like setting the commands into your variable list

i know that it won't work thats why im asking for another method that does work. i can store the commands into a list variable but that kinda ruins the purpose. I dont like it like this:
code_language.skript:
on command:
    if command is "ping" or "spawn" or "tpa":
        cancel event
That would be harder to manage and in my eyes its not so clean since i need to cancel certain commands based on the game people are playing. I am doing this with an if statement.

so this is the only method?
code_language.skript:
on command:
    if command is "ping" or "spawn" or "tpa":
        set {_counter} to 1
        loop {Game.A1.players::*}
            if player is {Game.A1.players::%{_counter}%}:
                cancel event
                message "You can't use this command ingame"
                stop loop
            add 1 to {_counter}
 
You could use
code_language.skript:
on command:
  "/%full command%" contains "/commandYouWantToBlock"
  send "You can't use this command in-game"
 
code_language.skript:
options:
    Commands: tpa, spawn, back
        
on command:
    set {_blocked::*} to split "{@Commands}" at ", "
    {_blocked::*} contains command
    cancel event
    message "Haha this command is blocked"
 
code_language.skript:
options:
    Commands: tpa, spawn, back
       
on command:
    set {_blocked::*} to split "{@Commands}" at ", "
    {_blocked::*} contains command
    cancel event
    message "Haha this command is blocked"
That's what i was looking for! thanks mate
 
Status
Not open for further replies.