Squirrel/Server/Events/Player/onPlayerAction

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (argument types)
 
Line 21: Line 21:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerAction( Player player, string text )
+
function onPlayerAction( player, text )
 
{
 
{
 
     if ( text == "died" )
 
     if ( text == "died" )

Latest revision as of 16:43, 10 July 2013

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

This is called when a player sends a /me action to the chat. This event is still called if the player is muted.

[edit] Syntax

  1. function onPlayerAction( Player player, string message )

[edit] Arguments

  • player - The player pointer
  • message - The "action" that the player did with /me

[edit] Returns

  • 1 - Send the action message to other clients, unless they're muted
  • 0 - Returning 0 will cancel this message and mute the player

[edit] Example

This example will kill the player if/when they type /me died.

  1.  
  2. function onPlayerAction( player, text )
  3. {
  4. if ( text == "died" )
  5. {
  6. // Kill the player >:D
  7. player.Health = 0;
  8. MessagePlayer( "You asked for it", player );
  9. }
  10. return 1;
  11. }
  12.  

[edit] Notes

The functions MessagePlayer and Player.Health were used in this example. More info about them can be found in the corresponding pages.

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox