AddCommand: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Client & Server|1.0}} | ||
{{FuncDescription|Adds a command that can be executed with the prefix '''/'''.}} | {{FuncDescription|Adds a command that can be executed with the prefix '''/'''.}} |
Revision as of 16:39, 15 August 2020
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)