mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add new onClientCoreCommand event

Open Pieter-Dewachter opened this issue 3 years ago • 6 comments

MTA has a few built-in clientside commands, however there is currently no way for scripts to know if any of those commands were executed. All existing ways of retrieving such info don't work for various reasons, namely: onPlayerCommand, addCommandHandler and onClientConsole. This pull request adds a new clientside event onClientCoreCommand which gets triggered for those specific commands, with one parameter: string command.

FYI: There are a lot of built-in client commands,, some are written here as reference:

  • help
  • ver
  • time
  • showhud
  • serial
  • bind
  • unbind
  • copygtacontrols
  • screenshots
  • saveconfig
  • cleardebug
  • test
  • showmemstat
  • showframegraph
  • fakelag
  • shownametags
  • showchat
  • shownetstat
  • showcol
  • showsound
  • ...

Pieter-Dewachter avatar Feb 18 '22 18:02 Pieter-Dewachter

What is the use case for this? I see point in triggering such event for commands like "showchat", "showhud" or "shownametags" but why for all commands?

lopezloo avatar Feb 18 '22 19:02 lopezloo

I personally would use it for "showchat" and "time", but I figured other people could have a use for the other commands as well.

Pieter-Dewachter avatar Feb 18 '22 20:02 Pieter-Dewachter

I don't see the point in this.

patrikjuvonen avatar Apr 08 '23 08:04 patrikjuvonen

You can't really add command handlers for hardcoded commands. For example if I want to make a command using /ver I can't, I need to name it differently. This should help.

PlatinMTA avatar Apr 08 '23 15:04 PlatinMTA

You would have to blacklist certain commands like login/register as you could simply build a keylogger for them.

ffsPLASMA avatar Apr 08 '23 15:04 ffsPLASMA

You would have to blacklist certain commands like login/register as you could simply build a keylogger for them.

https://wiki.multitheftauto.com/wiki/Client_Commands

login/register aren't client commands, and register isn't even an MTA command, it's built into the admin panel resource.

The only client command that pontentially exposes a password is connect <host> [<port> <nick> <pass>].

It would be useful to detect when the player uses /help or /time to display other stuff in the chatbox or in some UI.

Fernando-A-Rocha avatar May 05 '24 12:05 Fernando-A-Rocha

I think it can be useful with side scripting with those commands to add extra functionality to them

Proxy-99 avatar Jul 03 '24 14:07 Proxy-99