Scripting/Squirrel/Functions/Player.Frozen: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary
No edit summary
 
(3 intermediate revisions by one other user not shown)
Line 2: Line 2:


<pre>
<pre>
player.IsFrozen = true;
player.Frozen = true;
player.IsFrozen = false;</pre>
player.Frozen = false;</pre>


'''Example'''
'''Example'''
Line 10: Line 10:
function onPlayerCommand( player, cmd, text )
function onPlayerCommand( player, cmd, text )
{
{
if ( cmd == "free" )
if ( cmd == "freeze" )
{
{
  local plr = FindPlayer( text ); // text/player name
  local plr = FindPlayer( text ); // text = player name


  if (!plr) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Checking player
  if (!plr) MessagePlayer( "Error: Player '" + plr + "' is not online.", player );//Checking player


  else player.IsFrozen = true;//Finally freeze him
  else player.IsFrozen = true; //Finally freeze him
}
}


if ( cmd == "free" )
if ( cmd == "freeze" )
{
{
  local plr = FindPlayer( 0 ); // Player ID
  local plr = FindPlayer( text.tointeger() ); // text.tointeger() can be used to get player id
   
   
  if (!plr) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Checking player
  if (!plr) MessagePlayer( "Error: Player '" + plr + "' is not online.", player );//Checking player
   
   
  else player.IsFrozen = true;//Finally freeze him
  else player.IsFrozen = true; //Finally freeze him
}
}


Line 31: Line 31:
</pre>
</pre>


'''Note''' - FindPlayer can be worked out with text/name or id of the player--[[User:Jayant|Jayant]] ([[User talk:Jayant|talk]]) 11:45, 8 January 2015 (UTC).To unfreeze player.IsFrozen = false;
'''Note''' - FindPlayer can be worked out with text/name or id of the player.To unfreeze anyone use player.Frozen = false; And player.Frozen can also be used in place of player.IsFrozen
 
--[[User:Jayant|Jayant]] ([[User talk:Jayant|talk]]) 11:46, 8 January 2015 (UTC)
 
== Related Functions ==
 
{{Scripting/Squirrel/Functions/Player_Functions}}
[[Category:Scripting/Squirrel/Functions/Player_Functions]]

Latest revision as of 18:48, 30 January 2017

Syntax

player.Frozen = true;
player.Frozen = false;

Example

function onPlayerCommand( player, cmd, text )
{
if ( cmd == "freeze" )
{
 local plr = FindPlayer( text ); // text = player name

 if (!plr) MessagePlayer( "Error: Player '" + plr + "' is not online.", player );//Checking player

 else player.IsFrozen = true; //Finally freeze him
}

if ( cmd == "freeze" )
{
 local plr = FindPlayer( text.tointeger() ); // text.tointeger() can be used to get player id
 
 if (!plr) MessagePlayer( "Error: Player '" + plr + "' is not online.", player );//Checking player
 
 else player.IsFrozen = true; //Finally freeze him
}

}

Note - FindPlayer can be worked out with text/name or id of the player.To unfreeze anyone use player.Frozen = false; And player.Frozen can also be used in place of player.IsFrozen

--Jayant (talk) 11:46, 8 January 2015 (UTC)

Related Functions

Player Game Functions

These functions exist for compatibility with the R2 Squirrel server.