AddCommand

From Onset Developer Wiki
Revision as of 21:29, 6 October 2020 by BlueMountains (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
AddCommand

Type: Function
Context: Client & 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

  • Returns true on success.

Example

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

See also