chat_commands 1.4.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 11:06:03 +02:00
parent 4b25be67f8
commit 57053b38a8
2 changed files with 175 additions and 64 deletions

View File

@ -8,8 +8,10 @@ If you do monitor your server with [IW4MAdmin](https://github.com/RaidMax/IW4M-A
## chat_commands.gsc
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.
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.
**[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.
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.
### Main features
@ -19,6 +21,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