Scripting/Squirrel/Functions/Player.Frozen: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary |
mNo edit summary |
||
Line 2: | Line 2: | ||
<pre> | <pre> | ||
player. | player.Frozen = true; | ||
player. | player.Frozen = false;</pre> | ||
'''Example''' | '''Example''' | ||
Line 10: | Line 10: | ||
function onPlayerCommand( player, cmd, text ) | function onPlayerCommand( player, cmd, text ) | ||
{ | { | ||
if ( cmd == " | if ( cmd == "freeze" ) | ||
{ | { | ||
local plr = FindPlayer( text ); // text | local plr = FindPlayer( text ); // text = player name | ||
if (!plr) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Checking player | if (!plr) MessagePlayer( "Error: Player '" + text + "' is not online.", player );//Checking player | ||
Line 19: | Line 19: | ||
} | } | ||
if ( cmd == " | if ( cmd == "freeze" ) | ||
{ | { | ||
local plr = FindPlayer( 0 ); // Player ID | local plr = FindPlayer( 0 ); // Player ID | ||
Line 31: | Line 31: | ||
</pre> | </pre> | ||
'''Note''' - FindPlayer can be worked out with text/name or id of the player.To unfreeze | '''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) | --[[User:Jayant|Jayant]] ([[User talk:Jayant|talk]]) 11:46, 8 January 2015 (UTC) |
Revision as of 19:46, 21 May 2015
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 '" + text + "' is not online.", player );//Checking player else player.IsFrozen = true;//Finally freeze him } if ( cmd == "freeze" ) { 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.To unfreeze anyone use player.Frozen = false; And player.Frozen can also be used in place of player.IsFrozen