ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server events
  3. onPlayerCommand

Event

onPlayerCommand

ServerChat and consoleIdentical to MTA:SA

A player typed a command (before addCommandHandler runs it). You can block it.

Handler

addEventHandler("onPlayerCommand", root, function(command, ...) ... end)

Parameters

commandstring
The command name.
...string
The words after the command.

Source

source is the player.

cancelEvent() blocks the command.

Example

addEventHandler("onPlayerCommand", root, function(command)
    if command == "kill" and getElementData(source, "wiezien") then cancelEvent() end
end)

See also