Squirrel/Server/Events/Player/onPlayerCommand
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example) |
|||
Line 27: | Line 27: | ||
MessagePlayer( "You slapped yourself! Now that wasn't very smart", player ); | MessagePlayer( "You slapped yourself! Now that wasn't very smart", player ); | ||
} | } | ||
+ | |||
+ | return 1; | ||
} | } | ||
</code> | </code> |
Revision as of 02:01, 16 October 2010
This is called when a player uses a command.
Syntax
function onPlayerCommand( player, command, parameters )
Parameters
- player - The pointer of the player
- command - This is the command player used
- parameters - This is the list of the parameters as a string
Example
This example command slaps the user if they type '/c slap'.
function onPlayerCommand( player, cmd, text ) { if ( cmd == "slap" ) { local pos = player.Pos; pos.z += 5; player.Pos = pos; MessagePlayer( "You slapped yourself! Now that wasn't very smart", player ); } return 1; }