Skip to content

Creating a simple command

Alexander edited this page Mar 13, 2019 · 2 revisions

Here you can see an example on how to create an simple command that sends an lovely message back.

//remember: manager is our functionManager
//here we register an command
//1st argument: command
//2nd argument: description
//3rd argument: function name
manager.createCommand("love", "get a lovely message", "loveCommand");

//Making an simple function that will be executed when the player uses the command love
function loveCommand(sender, args){
    //Getting player instead of sender object.
    var player = cast.asPlayer(sender);
    //Here we can send a message to the player with using the sendMessage function
    player.sendMessage("Sometimes I can’t see myself when I’m with you. I can only just see you.");
}
Clone this wiki locally