Squirrel/Client/Events/Player/onClientCommand

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
This event is called when the local player types a / command
+
 
 +
{{Squirrel/Title|onClientCommand}}
 +
This event is called when the local player types any command (I.E.: /kill)
  
 
== Syntax ==
 
== Syntax ==
  
<code>function onClientCommand( cmd, text )</code>
+
<code>
 +
function onClientCommand( command, text )
 +
</code>
  
 
=== Arguments ===
 
=== Arguments ===
  
* '''cmd''' - The command typed
+
* '''command''' - The command typed
 
* '''text''' - The text passed to the command
 
* '''text''' - The text passed to the command
  
Line 36: Line 40:
  
 
== Related Events ==
 
== Related Events ==
{{Squirrel/Title|onClientCommand}}
 
 
{{Squirrel/Client/Events/Player}}
 
{{Squirrel/Client/Events/Player}}

Latest revision as of 23:07, 11 August 2016


Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This event is called when the local player types any command (I.E.: /kill)

[edit] Syntax

  1.  
  2. function onClientCommand( command, text )
  3.  

[edit] Arguments

  • command - The command typed
  • text - The text passed to the command

[edit] Returns

  • 1 - Let the command be sent to the server.
  • 0 - Stops the command being sent to the server

[edit] Example

Displays a text for you when they type '/text'

  1.  
  2. function onClientCommand ( szCommand, szParams )
  3. {
  4. if ( szCommand == "text" )
  5. {
  6. Message ( "Your own message." );
  7. }
  8.  
  9. return 1;
  10. }
  11.  

[edit] Notes

The functions Message were used in in this example. More info about them in corresponding pages.

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox