Scripting/Squirrel/Functions/Player.Immunity: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
Soulshaker (talk | contribs) |
Soulshaker (talk | contribs) (→Flags) |
||
Line 6: | Line 6: | ||
<pre>Player.Immunity = integer;</pre> | <pre>Player.Immunity = integer;</pre> | ||
== | == Flags == | ||
1 | 1 = bulletproof | 2 = fireproof | 4 = explosion-proof | 8 = collision-proof | 16 = melee-proof | ||
2 | |||
4 | |||
8 | |||
16 | |||
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. | 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. |
Revision as of 19:09, 27 August 2015
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.