Disable 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 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!

JuliHatSpaB

Member
Aug 18, 2023
47
1
8
I want to disable a command if a specific variable is set to false. Until now I did it like this:
Code:
command /fire:
    trigger:
        if {fire} is set tot true:
        else:
            send "This feature is disabled"
But then the command still shows up in the tab completions for /f... But how do I disable this?
 
Ummm. That code has many errors in it. To answer your question, no you cannot hide it from tab completions. if you want help with code, feel free to ask
 
Here, this is the fixed version of your current code.
Code:
command /fire:
    trigger:
        if {fire} is set to true:
            send "This feature is enabled"
        else:
            send "This feature is disabled"
Idk if this works but you can try this:
Code:
every 1 tick:
  loop all players:
    if loop-player has permission "example.permission":
      # write your command here, remember to replace player with loop-player
      command /bigbrain:
        trigger:
          send "lmao" to loop-player
 
Code:
every 1 tick:
  loop all players:
    if loop-player has permission "example.permission":
      # write your command here, remember to replace player with loop-player
      command /bigbrain:
        trigger:
          send "lmao" to loop-player
ehh, im not sure if looping all players every 1 tick is good idea, but okay :emoji_dizzy_face:
 
Ummm. That code has many errors in it. To answer your question, no you cannot hide it from tab completions. if you want help with code, feel free to ask
It was just a random code I've never tried. Just to show you an example.
But would it work if I would put it in a different script and just disable the sctipt? And if the feature is enabled, I enable the file again. I guess it wouldn't be possible to enable it for 1 player and disable it for the other..? Would this be an idea?
 
It was just a random code I've never tried. Just to show you an example.
But would it work if I would put it in a different script and just disable the sctipt? And if the feature is enabled, I enable the file again. I guess it wouldn't be possible to enable it for 1 player and disable it for the other..? Would this be an idea?
If your now asking how to disable a command, I can help. First let me say one thing, skript doesn’t have a “command disabling” function that works entirely, doing it this way will disable the command but they can still run /%plugin%:%command%. If you would like to disable it entirely your better off with a plug-in.
code_language.skript:
command /plugins:
  aliases: # Put all of the commands you want to disable seperated by commas here
  trigger:
    cancel event
    send "&l&c!&r Hey, that command has been disabled"
 
If your now asking how to disable a command, I can help. First let me say one thing, skript doesn’t have a “command disabling” function that works entirely, doing it this way will disable the command but they can still run /%plugin%:%command%. If you would like to disable it entirely your better off with a plug-in.
code_language.skript:
command /plugins:
  aliases: # Put all of the commands you want to disable seperated by commas here
  trigger:
    cancel event
    send "&l&c!&r Hey, that command has been disabled"
Oh i see, I didn’t read your response fully, here’s a skript for disabling it for certain players only

code_language.skript:
command /plugins:
  aliases: # Put all of the commands you want to disable seperated by commas here
  trigger:
    if player is {blockedcmd::*}:
      cancel event
      send "&l&c!&r Hey, that command has been disabled
command /blockcmds <player>:
  permission: op
  trigger:
    add player to {blockedcmd::*}