Need help with /cmdjoin and /cmdleave commands!

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

PonasLukas

Member
Dec 7, 2017
2
0
0
24
Hello, So Iam trying to code my very first minigame and I have difficulties of making the command which shouldnt be usable in the game, for example: When player writes "/cmdjoin" he gets teleported to waiting lobby and then he writes same command and nothing happens. This is my question: How can I block command in the minigame?
 
This should do the trick. This is a command whitelist so you can add commands what you want people to use, anything else will be blocked.
code_language.skript:
on command:
    loop {game.commandwhitelist::*}:
        if command is loop-value:
            stop
        else:
            cancel event
                send "&cYou can not do this, while in this mini-game."
                stop loop
 
command /gamecmdwhitelist [<text>]:
    trigger:
        if arg 1 is set:
            add argument-2 to {game.commandwhitelist::*}:
 
This should do the trick. This is a command whitelist so you can add commands what you want people to use, anything else will be blocked.
code_language.skript:
on command:
    loop {game.commandwhitelist::*}:
        if command is loop-value:
            stop
        else:
            cancel event
                send "&cYou can not do this, while in this mini-game."
                stop loop
 
command /gamecmdwhitelist [<text>]:
    trigger:
        if arg 1 is set:
            add argument-2 to {game.commandwhitelist::*}:
Thanks! Works like a charm!
 
Status
Not open for further replies.