ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. executeCommandHandler

Function

executeCommandHandler

Server and clientInput and controlsIdentical to MTA:SA

Runs a command registered with addCommandHandler as if a player typed it. On the server you pass a player (or nil) and the arguments: a single string is split into words like in chat. On the client it runs client commands.

Syntax

Server

bool executeCommandHandler(string commandName, player thePlayer [, string args])

Client

bool executeCommandHandler(string commandName [, string args])

Arguments

commandNamestring
Command name.
thePlayerplayer
The player who "typed" the command (server only).
argsstring, optional
Command arguments.

Returns

true if the command exists and was run.

Example

addEventHandler("onPlayerJoin", root, function()
    executeCommandHandler("pomoc", source)
end)

See also