Jump to content

How to make commands with Skript.


UntitledGoose

Recommended Posts

 

M I N E H U T  C O M M U N I T Y  F A Q

HOW TO MAKE COMMANDS WITH SKRIPT

REQUIREMENTS: Skript
DIFFICULTY: MEDIUM

Introduction:

Ever wanted to make custom commands for you and your players? Skript allows you to do just that!

Register a Command:

Registering a command is very simple with Skript. This is what a command in Skript looks like:

command /name <arguments>: # keep in mind that arguments and the slash before the command name are optional
	(parameters) # parameters are optional, they will be explained in detail later
	trigger:
		# your code

Arguments:

Arguments are fields that a user can fill out when executing a command. Arguments can be anything in Skript, as long as it isn’t the type ‘object’.

Arguments in Skript can also be optional, so the user can fill them out, but doesn’t have to. You can make arguments optional by surrounding them with square brackets. Example: '<string> -> [<string>]'

Arguments can also be plural! For example, 'string -> strings', 'integer -> integers'

Parameters:

Parameters are options that you can place before the trigger in a custom command, they allow you to specify properties like permissions required, cooldowns, etc.There are lots of parameters you can use in commands! Here is a list of all of them:

permission - A permission required to run the command.
permission message - A message sent to the user if they don't have the permission required to use the command.
cooldown - A cooldown for the command.
cooldown bypass - A permission required to bypass the cooldown of a command.
cooldown storage - A variable that the cooldown is stored in, it will stay even after the server restarts.
description - A description for the command.
aliases - A list of aliases for your command, (ex. /alias1, /alias2, /alias3), the slash in the aliases is optional.
usage - A message sent to the user if they used the command incorrectly.
executable by - Specifies who can use the command, it can be console, players, or console and players.

Getting arguments:

When a player inputs arguments in a command, you can get the values with this syntax!

[the] last arg[ument][s]
[the] arg[ument][s](-| )%number%
[the] (1st|2nd|3rd|4-90th) arg[ument][s]
[the] arg[ument][s]
[the] %type%( |-)arg[ument][( |-)%number%]
[the] arg[ument]( |-)%type%[( |-)%number%

Examples:

command discord:
	trigger:
		send "&aYou can join our discord here! https://discord.gg/minehut"

 

command cake:
	aliases: /getcake, /receivecake, /givemecake
	description: Receive a cake, only usable once per day!
	permission: cake.is_a_lie
	permission message: &cNo cake!
	cooldown: a day
	cooldown message: &cOnly cake once per day!
	cooldown storage: {cake::%player's uuid%}
	cooldown bypass: cake.gobble
	trigger:
		give player cake
		send "&aYou have received cake!"

Require further assistance?:

If you need more help on this topic, head over to this section of forums, or join our Discord!

📎  https://youtu.be/NIpzRWdgO_I

Compiled by the Minehut Staff Team

VIP since January 7th, 2020

Support since September 19th, 2020

Helper since November 3rd, 2020

Moderator since March 8th, 2021

unknown.png

5.png.e14b1bf83edf0ac2edc1bfb822177184.png

image.png.fe30b7b2c0be5a541ba4ed2187b23030.png

Link to comment
Share on other sites

  • muelr changed the title to How to make commands with Skript.
  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...