Solved Temporarily 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 comminuty!

    Now, what are you waiting for? Join the community now!

zainmz

Member
Apr 29, 2017
22
1
0
25
I would like to know how could i temporarily disable a player from running commands. Im creating a minigame , so i dont want the player to teleport, since there are many teleport commands on my server .
 
Like this?
code_language.skript:
command /disablecmds:
    trigger:
    if {server.commands} is not set:
        set {server.commands} to false
        send "&6You have disabled commands!"
    else if {server.commands} is true:
        set {server.commands} to false
        send "&6You have disabled commands!"
    else:
        set {server.commands} to true
        send "&6You have enabled commands!"

on command:
    if {server.commands} is false:
        cancel event
        send "&6Commands are disabled!"
 
  • Like
Reactions: zainmz
@zainmz Do not use the one @OfficialLiovo because you will not be able to re-enable command and anyone can use the command. Use the one I have instead

code_language.skript:
on load:
    set {server.commands} to true

command /disablecmds:
    trigger:
        if player has permission "command.disable":
            if {server.commands} is true:
                set {server.commands} to false
                send "&6You have disabled commands."
            else:
                set {server.commands} to true
                send "&6You have enabled commands."
        else:
            send "You do not have permission."
command /cdisablecmds:
    executable by: console
    trigger:
        if {server.commands} is true:
            set {server.commands} to false
            send "&6You have disabled commands."
        else:
            set {server.commands} to true
            send "&6You have enabled commands."

on command:
    if {server.commands} is false:
        if player doesn't have permission "command.bypass":
            cancel event
            send "&6Commands are disabled"
    else if {server.commands} is true:
The /cdisablecmds is only for console just in case you need it. To disable commands you need the command.disable permission and if you have and.bypass you can bypass it if it's disabled
 
  • Like
Reactions: zainmz