Squirrel/Client/Events/Player/onClientCommand
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example) |
PerikiyoXD (Talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
{{Squirrel/Title|onClientCommand}} | {{Squirrel/Title|onClientCommand}} | ||
− | This event is called when the local player types | + | This event is called when the local player types any command (I.E.: /kill) |
== Syntax == | == Syntax == | ||
− | <code>function onClientCommand( | + | <code> |
+ | function onClientCommand( command, text ) | ||
+ | </code> | ||
=== Arguments === | === Arguments === | ||
− | * ''' | + | * '''command''' - The command typed |
* '''text''' - The text passed to the command | * '''text''' - The text passed to the command | ||
Line 18: | Line 21: | ||
== Example == | == Example == | ||
− | Displays a text | + | Displays a text for you when they type '/text' |
<code lang="squirrel"> | <code lang="squirrel"> | ||
Line 34: | Line 37: | ||
=== Notes === | === Notes === | ||
− | The functions [[Squirrel/ | + | 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}} |
Latest revision as of 23:07, 11 August 2016
This event is called when the local player types any command (I.E.: /kill)
[edit] Syntax
function onClientCommand( command, text )
[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'
function onClientCommand ( szCommand, szParams ) { if ( szCommand == "text" ) { Message ( "Your own message." ); } return 1; }
[edit] Notes
The functions Message were used in in this example. More info about them in corresponding pages.
[edit] Related Events
- onClientArmourChange
- onClientCashChange
- onClientCollideWithPlayer
- onClientCommand
- onClientDeath
- onClientFall
- onClientHealthChange
- onClientHurt
- onClientKill
- onClientKeyStateChange
- onClientRequestClass
- onClientRequestSpawn
- onClientShot
- onClientSpawn
- onClientUseDetonator
- onClientWeaponChange
- onPlayerDeath
- onPlayerJoin
- onPlayerKill
- onPlayerPart
- onPlayerSpawn