Scripting/Squirrel/Functions/Player.Immunity

From Vice City Multiplayer
Revision as of 13:59, 30 January 2018 by Human. (talk | contribs)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

This function is used to get or set a player's immunity.

Syntax

player.Immunity = flags;

Flags

1 = bulletproof | 2 = fireproof | 4 = explosion-proof | 8 = collision-proof | 16 = melee-proof | 32 = immune to falling down | 64 = immune to critical shot/headshot

0 means no immunity, 127 means full immunity. You can add all the numbers together or use bitwise OR/AND to toggle flags.

Example

function onPlayerCommand( player, cmd, text )
{
	if ( cmd == "showimmunity" )
	{
		/* Show your immunity */
		MessagePlayer( "Your immunity: "+ player.Immunity, player );
	}
	else if ( cmd == "setimmunity" )
	{
		/* You can also add up the numbers such as ( 1 + 2 + 4 + 6 + 8 + 16 ) is equal to 31 */
		player.Immunity = ( 1 | 2 | 4 | 8 | 16 );
		MessagePlayer( "You are now immune to bullet, fire, explosion, collision and melee", player );
	}
}

Related Functions

Player Game Functions

These functions exist for compatibility with the R2 Squirrel server.