Scripting/Squirrel/Functions/Player.Immunity
This wiki is using an old backup from 2020
Some information may be old/missing
This function will set a player's immunity to whatever % you type want.
Syntax
Player.Immunity = integer;
Flags
1 = bulletproof | 2 = fireproof | 4 = explosion-proof | 8 = collision-proof | 16 = melee-proof
0 means no immunity to any damage, 31 means immunity to all damage. You can add all the numbers together or use bitwise OR/AND to toggle flags.
Example
The following example will set a player's immunity to whatever % you type want.
function onPlayerCommand( player, cmd, text );
{
if ( cmd == "im" )
{
if (!text) ClientMessage("/im <Nick> <Immunity>",player,255,255,0);
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
local im = GetTok( text, " ", 2, NumTok( text, " " ) );
plr.Immunity = im.tointeger();
ClientMessageToAll(player.Name+" has set "+plr.Name+"'s immunity to "+im+"!",198,213,0);
}
}
}
Notes
Call onPlayerCommand were used in this example. More info about them in the corresponding pages. Call ClientMessage were used in this example. More info about them in the corresponding pages. Call ClientMessageToAll were used in this example. More info about them in the corresponding pages.