Scripting/Squirrel/Functions/Players/IsMuted

From VC-MP Wiki

Jump to: navigation, search

This instance variable returns or sets player's mute status. If player has been muted, their chat, personal messages or team chat does not appear in-game, but those events trigger the scripting signals.

Syntax

bool player.IsMuted

player.IsMuted = bool bMuted

Example 1. Returning

This example returns whether a player has been muted or not when they type '/c muted <name>'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "muted" )
     {
          local plr = FindPlayer( text );
          
          if ( !plr ) MessagePlayer( "Error: Player " + text + " is currently offline.", player );
          else if ( plr.IsMuted ) MessagePlayer( plr.Name + " has been muted", player );
          else MessagePlayer( plr.Name + " has not been muted", player ); 
     }
}

Notes

The functions MessagePlayer, FindPlayer, player.Name and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Example 2. Setting

This command mutes the player when they type '/c ispeakrubbish'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "ispeakrubbish" )
     {
          player.IsMuted = true;
     }
}

Notes

The call onPlayerCommand was used in in this example. More info about it in the corresponding page.


Related Functions

Personal tools
squirrel scripting