- Documentation
- Client functions
- executeCommand
Function
executeCommand
Sends a command to the server as if the player typed it in chat (without the leading slash).
Syntax
bool executeCommand(string command)Arguments
commandstring- The command with arguments, e.g.
"car 411".
Returns
true if the command was sent.
Example
bindKey("F5", "down", function()
executeCommand("auto 411")
end)
See also
executeCommandHandlerRuns a command registered withaddCommandHandleras if a player typed it. On the server you pass a player (ornil) and the arguments: a single string is split into words like in chat. On the client it runs client commands.addCommandHandlerRegisters a chat and console command (e.g./car). When a player types it, the function is called. On the server the function gets the player, the command name and the following words as separate arguments; on the client the command name and the words. One command can have several functions, also from different resources. The command goes away with the resource that added it.