onPlayerChat

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This is called when a player sends a chat message. This event is called even if the player is muted.

Syntax

  1. function onPlayerChat( Player player, string message )

Arguments

  • player - The player who spoke
  • message - The message the player sent

Returns

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

Example

This example checks if the player has been muted, and if they are, sends a message to them stating they have been muted.

  1.  
  2. function onPlayerChat( player, text )
  3. {
  4. if ( player.Muted )
  5. {
  6. MessagePlayer( "You are currently muted.", player );
  7. }
  8. return 1;
  9. }
  10.  

Notes

The functions MessagePlayer and Player.Muted were used in this example. More info about them in the corresponding pages.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox