AddCommand: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 6: Line 6:


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|CommandName|The specified command name.}}
{{FuncParam|CommandName|The specified command name. Command names are always lower case.}}
{{FuncParam|LuaFunction|The function name.}}
{{FuncParam|LuaFunction|The function name.}}


Line 22: Line 22:


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[AddPlayerChat]]

Revision as of 18:45, 28 April 2020

AddCommand

Type: Function
Context: Server
Introduced: v1.0

Description

Adds a command that can be executed with the prefix /.

Syntax

AddCommand(CommandName, LuaFunction)

Parameters

  • CommandName
    The specified command name. Command names are always lower case.
  • LuaFunction
    The function name.

Return Value

  • None.

Example

function cmd_commands(playerid)
	AddPlayerChat(playerid, "You just executed a command!")
	return
end
AddCommand("commands", cmd_commands)
AddCommand("cmds", cmd_commands)

See also