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) (→Syntax) |
Soulshaker (talk | contribs) |
||
Line 13: | Line 13: | ||
== Example == | == Example == | ||
<source lang=squirrel> | <source lang=squirrel> | ||
function onPlayerCommand( player, cmd, text ) | function onPlayerCommand( player, cmd, text ) | ||
{ | |||
if ( cmd == "immunity" ) | |||
{ | { | ||
MessagePlayer("Now you are immune to bullet/fire/explosion/collision/melee",player); | |||
player.Immunity = 31; | |||
} | |||
} | } | ||
</source> | </source> | ||
Revision as of 19:18, 27 August 2015
This function will set a player's immunity to whatever % you type want.
Syntax
Player.Immunity = flags;
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
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "immunity" )
{
MessagePlayer("Now you are immune to bullet/fire/explosion/collision/melee",player);
player.Immunity = 31;
}
}