Skip to content

onClientCommand event before trigger onPlayerCommand server side #2615

@hxnrxqxx

Description

@hxnrxqxx

Is your feature request related to a problem? Please describe.

I'm trying to handle the situation when the player enters some invalid command, e.g. (/givemoney) so i do expect to receive the command and try to run this command client side to show some error or warning ('Command /givemoney not found') before any try to execute the command server side.

I don't like the current way this is handled by MTA at all. Even invalid commands are sent to the server and as far i know we can't define the bandwidth for this event. But just to be clear my problem here is not performance, but usability.

Describe the solution you'd like

A client side event 'onClientCommand' could be very useful for my problem. If i cancel this event i do expect the command not being sent to the server (via onPlayerCommand). This would allow me to change the way invalid commands/arguments are handled effectively.

Describe alternatives you've considered

I considered to create a .xml with valid commands / arguments but anyway the command would be sent to the server and on busy servers this could hurt.

Additional context

My goal is (pseudocode):

Client side

addEventHandler("onClientCommand", root, ...
cancelEvent()
if not executeCommandHandler ...
send the command to server ...

Server side

addEventHandler("onPlayerCommand, root ...
cancelEvent()
if not executeCommandHandler ...
(send fail feedback to client)

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions