Squirrel/Client/Events/Player/onClientCommand

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
(Notes)
Line 34: Line 34:
 
=== Notes ===
 
=== Notes ===
  
The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] were used in in this example. More info about them in corresponding pages.
+
The functions [[Squirrel/Client/Functions/Messages/Message|Message]] were used in in this example. More info about them in corresponding pages.
  
 
== Related Events ==
 
== Related Events ==
  
 
{{Squirrel/Client/Events/Player}}
 
{{Squirrel/Client/Events/Player}}

Revision as of 12:50, 12 November 2013

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

This event is called when the local player types a / command

Syntax

  1. function onClientCommand( cmd, text )

Arguments

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

Returns

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

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.  

Notes

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

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox