chat_commands 1.1.0

Added an alias system so that a command can be called with different names.
The alias commands respects the permission system and can be used seemingly with the help and alias command.
The commands command still only lists the original/full command name, it doesn't list aliases
CreateCommand now has an addition argument commands can use: commandAliases

Added a new !alias or !aliases command
With these commands you can get the available alias(es) of a command by its original name or one of its alias
For example !alias god or !alias godmode

Some refactor to make the ChatListener function easier to read along with some comments to separate each command logic (built-in commands and "any other command")

Added CommandAliasesDoesNotExistError

Added GetCommandNameFromAlias util function
This commit is contained in:
Resxt
2023-06-17 10:25:39 +02:00
parent b3dd62f64e
commit 52820e82fc
2 changed files with 206 additions and 65 deletions

View File

@ -12,11 +12,13 @@ MP only scripts are in the [mp](mp) folder and ZM only scripts are in the [zm](z
The core script that holds the configuration, runs all the chat logic and holds utils function that are shared between all the `chat_command` scripts.
**[IMPORTANT]** Installing it is **mandatory** to make the commands work as this is the core of this whole system and all the command scripts depend on it.
**[IMPORTANT]** By default this script is made to be placed in the `scripts` folder. If you place it in the `scripts\mp` or `scripts\zm` folder instead then you will need to update the include of each command script accordingly (first line) or you will get errors.
**[IMPORTANT]** Installing `chat_commands.gsc` is **mandatory** to make the commands work as this is the core of this whole system and all the command scripts depend on it.
**[IMPORTANT]** By default `chat_commands.gsc` is made to be placed in the `scripts` folder.
If you place it in the `scripts\mp` or `scripts\zm` folder instead then you will need to update the include of each command script accordingly (first line) or you will get errors.
You simply have to replace `#include scripts\chat_commands` with `#include scripts\mp\chat_commands;` or `#include scripts\zm\chat_commands;` in each of your command script.
Also note that this script doesn't provide any command on its own. You must install at least one command script to be able to use commands. Otherwise it will always say that you don't have any command.
Also note that `chat_commands.gsc` doesn't provide any command on its own.
You must install at least one command script to be able to use commands. Otherwise it will always say that you don't have any command.
### Main features
@ -26,6 +28,7 @@ Also note that this script doesn't provide any command on its own. You must inst
- All exceptions are handled with error messages (no commands on the server, not enough arguments, command doesn't exist, command doesn't have any help message, player doesn't exist etc.)
- A `commands` command that lists all available commands on the server you're on dynamically (only lists commands you have access to if the permission system is enabled)
- A `help` command that explains how to use a given command. For example `help map` (only works on commands you have access to if the permission system is enabled)
- `alias` and `aliases` commands that list the available aliases for a command. For example `alias godmode` (only works on commands you have access to if the permission system is enabled)
- All commands that require a target work with `me`. Also it doesn't matter how you type the player's name as long as you type the full name.
- Configurable command prefix. Set to `!` by default
- A plugin system to easily allow adding/removing commands. Each command has its own GSC file to easily add/remove/review/configure your commands. This also makes contributing by creating a PR to add a command a lot easier