ExecuteCommandHandler: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 19: Line 19:


==Example==  
==Example==  
<section name="Server" class="server">
This example defines a command handler for the command ''createmarker'' (which creates a red marker at the caller's position). It then creates a second command handler ''createmarker2'' which will call the first one.
This example defines a command handler for the command ''createmarker'' (which creates a red marker at the caller's position). It then creates a second command handler ''createmarker2'' which will call the first one.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 45: Line 46:
addCommandHandler ( "createmarker2", consoleCreateMarker2 )
addCommandHandler ( "createmarker2", consoleCreateMarker2 )
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Server functions}}
{{Server functions}}

Revision as of 14:43, 26 August 2007

This function will call all the attached functions of an existing console command, for a specified player.

Syntax

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

Required Arguments

  • commandName: The name of the command you wish to execute. This is what must be typed into the console to trigger the function.
  • thePlayer: The player that will be presented as executer of the command to the handler function(s) of the command

Optional Arguments

  • args: Additional parameters that will be passed to the handler function(s) of the command that is called.

Returns

Returns true if the command handler was called successfully, false otherwise.

Example

Click to expand [+]
Server

See Also