Squirrel/Client/Events/Player/onClientCommand
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|onClientCommand}} This event is called when the local player types a / command == Syntax == <code>function onClientCommand( cmd, text )</code> === Arguments =…') |
(→Example) |
||
Line 18: | Line 18: | ||
== Example == | == Example == | ||
− | + | Displays a text. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onClientCommand ( szCommand, szParams ) | |
+ | { | ||
+ | if ( szCommand == "text" ) | ||
+ | { | ||
+ | Message ( "Your own message." ); | ||
+ | } | ||
+ | |||
+ | return 1; | ||
+ | } | ||
</code> | </code> | ||
=== Notes === | === Notes === | ||
− | + | The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] 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 16:39, 11 November 2013
This event is called when the local player types a / command
Syntax
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.
function onClientCommand ( szCommand, szParams ) { if ( szCommand == "text" ) { Message ( "Your own message." ); } return 1; }
Notes
The functions MessagePlayer were used in in this example. More info about them in corresponding pages.
Related Events
- onClientArmourChange
- onClientCashChange
- onClientCollideWithPlayer
- onClientCommand
- onClientDeath
- onClientFall
- onClientHealthChange
- onClientHurt
- onClientKill
- onClientKeyStateChange
- onClientRequestClass
- onClientRequestSpawn
- onClientShot
- onClientSpawn
- onClientUseDetonator
- onClientWeaponChange
- onPlayerDeath
- onPlayerJoin
- onPlayerKill
- onPlayerPart
- onPlayerSpawn