Scripting/Squirrel/Functions/Player.Immunity

From Vice City Multiplayer
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 );
	}
}

Notice

Even in singleplayer Vice City, any immunity value is known to not work with M60, Revolver, Helicannon.

So, you will need to implement some changes on onPlayerHealthChange( player, lastHP, newHP ) , to create a anti spawn system correctly.

Related Functions

Player Game Functions

These functions exist for compatibility with the R2 Squirrel server.