Scripting/Squirrel/Functions/Players/IsFrozen

From VC-MP Wiki

Jump to: navigation, search

This instance variable returns or sets player's control status.

Syntax

bool player.IsFrozen

player.IsFrozen = bool bControlsDisabled

Example 1. Returning

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

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "frozen" )
     {
          local plr = FindPlayer( text );
          
          if ( !plr ) MessagePlayer( "Error: Player " + text + " is currently offline.", player );
          else if ( plr.IsFrozen ) MessagePlayer( plr.Name + " has been frozen", player );
          else MessagePlayer( plr.Name + " has not been frozen", 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 freezes the player when they type '/c freezeme'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "freezeme" )
     {
          player.IsFrozen = 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