Squirrel/Server/Events/Player/onPlayerCommand
From Liberty Unleashed Wiki
(Difference between revisions)
m (Fixed a fail link) |
|||
Line 38: | Line 38: | ||
=== Notes === | === Notes === | ||
− | The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Players/Pos|Player.Pos] were used in this example. More info about them can be found in the corresponding pages. | + | The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Players/Pos|Player.Pos]] were used in this example. More info about them can be found in the corresponding pages. |
== Related Events == | == Related Events == | ||
{{Squirrel/Server/Events/Player}} | {{Squirrel/Server/Events/Player}} |
Latest revision as of 18:53, 22 December 2010
This is called when a player types a command.
[edit] Syntax
function onPlayerCommand( Player player, string command, string args )
[edit] Arguments
- player - The pointer of the player
- command - This is the typed command
- args - This is the list of parameters as a string
[edit] Returns
This event does not handle return values.
[edit] Example
This example command slaps the user if they type '/slap'.
function onPlayerCommand( player, cmd, text ) { if ( cmd == "slap" ) { local pos = player.Pos; pos.z += 5.0; player.Pos = pos; MessagePlayer( "You slapped yourself! That wasn't very smart.", player ); } return 1; }
[edit] Notes
The functions MessagePlayer and Player.Pos were used in this example. More info about them can be found in the corresponding pages.
[edit] Related Events
- onPlayerAction
- onPlayerArmourChange
- onPlayerCashChange
- onPlayerChat
- onPlayerCommand
- onPlayerConnect
- onPlayerDeath
- onPlayerFall
- onPlayerHealthChange
- onPlayerIslandChange
- onPlayerJoin
- onPlayerKeyStateChange
- onPlayerKill
- onPlayerPart
- onPlayerScoreChange
- onPlayerSkinChange
- onPlayerSpawn
- onPlayerUpdate
- onPlayerTeamChange
- onPlayerUseDetonator
- onPlayerVirtualWorldChange
- onPlayerWeaponChange