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
Line 1: Line 1:
{{Scripting/Needs_Text}}
== Syntax ==
== Syntax ==


Line 12: Line 10:
function onPlayerCommand( player, cmd, text )
function onPlayerCommand( player, cmd, text )
{
{
if ( cmd == "free" )
if ( cmd == "free" )
    {
{
      local plr = FindPlayer( text ); // text is the name of the player
local plr = FindPlayer( text ); // text/player name
      if ( !plr ) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Check status of player
 
      else player.IsFrozen = true;//Finally freeze him
if (!plr) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Checking player
    }


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


if ( cmd == "free" )
if ( cmd == "free" )
    {
{
      local plr = FindPlayer( 0 ); // id of the player
local plr = FindPlayer( 0 ); // Player ID
      if ( !plr ) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Check status of player
      else player.IsFrozen = true;//Finally freeze him
if (!plr) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Checking player
    }
}<pre/>
else player.IsFrozen = true;//Finally freeze him
}
 
}
</pre>


'''Note''' - FindPlayer can be worked out with text/name or id of the player'''
'''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;
{{Scripting/Needs_Example}}

Revision as of 11:45, 8 January 2015

Syntax

player.IsFrozen = true;
player.IsFrozen = false;

Example

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

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

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

if ( cmd == "free" )
{
 local plr = FindPlayer( 0 ); // Player ID
 
 if (!plr) MessagePlayer( "Error: Player '" + text + "' 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--Jayant (talk) 11:45, 8 January 2015 (UTC).To unfreeze player.IsFrozen = false;