Skip to main content

CustomCommand

Creates a command and binds it to the script. When the command is ran, it executes the script.

Injects the following variables into the script:
> @sender (the player who ran the command, NOT added when command is ran by the server console)
> *command (reference to this 'CustomCommand', used for resetting cooldown)

Syntax

!-- CustomCommand command name

Inline argument

  • Name: command name
  • Required: Yes
  • Description: The name of the command to create
!-- CustomCommand myban

Options

-- availableFor

Specifies from which console the command can be executed from. Accepts: Player or RemoteAdmin or Server. Defaults to 'server' and 'remoteAdmin'.

Required: No

-- availableFor player remoteAdmin

-- requireSender

Makes sure that the @sender variable exists when the command is executed.

Required: No

-- requireSender

-- description

The description of the command.

Required: No

-- description "Used to ban a player"

-- neededPermission

The permission that the player has to have in order to be able to use this command.
You can provide multiple permissions, and if the player has any of the listed permissions, they will be able to use the command.

Required: No

-- neededPermission ban.use ban.bypass

-- noPermissionMessage

Defines a message for when the sender does not have the needed permission (defined in 'neededPermission' argument).

Required: No

-- noPermissionMessage "You do not have the required permissions to ban a player!"

-- neededRank

The required remote admin rank in order to have access to this command.
You can provide multiple ranks, and if the player has any of the listed ranks, they will be able to use the command.

Required: No

-- neededRank owner admin moderator staff

-- invalidRankMessage

Defines a message for when the sender does not have the needed rank (defined in 'neededRank' argument).

Required: No

-- invalidRankMessage "You are not server staff!"

-- cooldown

The time the player has to wait before being able to use the command again.

Required: No

-- cooldown 30s

-- onCooldownMessage

Defines a message for when the player tries to run a command but is on cooldown.
Additionally, you can use %time% in the message to show the remaining time (in seconds) the player has to wait before being able to use the command again.

Required: No

-- onCooldownMessage "You are on cooldown! You can use this command in %time% seconds."

-- globalCooldown

The time all players have to wait before being able to use the command again.
If anyone uses a command, everyone else will be unable to use it for the specified duration.
This also applies to the server console.

Required: No

-- globalCooldown 30s

-- onGlobalCooldownMessage

Defines a message for when someone tries to run a command but is on global cooldown.
Additionally, you can use %time% in the message to show the remaining time (in seconds) someone has to wait before being able to use the command.

Required: No

-- onGlobalCooldownMessage "This command is on cooldown! You can use this command in %time% seconds"

-- maxUses

The maximum number of times a player can use this command.

Required: No

-- maxUses 5

-- onMaxUsesMessage

Defines a message for when the player tries to run a command but has reached their maximum usage limit.

Required: No

-- onMaxUsesMessage "You have already used this command 5 times!"

-- globalMaxUses

The maximum number of times this command can be used globally.

Required: No

-- globalMaxUses 10

-- onGlobalMaxUsesMessage

Defines a message for when the command has reached its global usage limit.

Required: No

-- onGlobalMaxUsesMessage "This command has reached its global usage limit!"

-- arguments

The arguments that this command expects in order to run.
The script cannot run unless every single argument is specified.

When the command is ran, the provided values for the arguments turn into their own literal local variables for you to use in the script.
For example: making a command with an argument 'name' will then create a local variable '$name' in your script.

If you want some arguments to be optional, you can use the '?' symbol after the argument name.
For example: 'reason?' argument will be optional, and if the sender does not provide a value for it, the script will still run.
Then, the '$reason' command will not be created in your script.

(the '?' suffix is NOT added to the variable names)

Required: No

-- arguments id time reason?