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
mNo edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
local plr = FindPlayer( text ); // text = player name | local plr = FindPlayer( text ); // text = player name | ||
if (!plr) MessagePlayer( "Error: 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 == "freeze" ) | if ( cmd == "freeze" ) | ||
{ | { | ||
local plr = FindPlayer( | local plr = FindPlayer( text.tointeger() ); // text.tointeger() can be used to get player id | ||
if (!plr) MessagePlayer( "Error: 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 | ||
} | } | ||
Revision as of 19:49, 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 '" + 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