Scripting/Squirrel/Functions/Player.Immunity: Difference between revisions

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
Line 19: Line 19:
  if ( cmd == "im" )
  if ( cmd == "im" )
  {
  {
  if (!text) ClientMessage("/"+cmd+" <Nick> <Immunity>",255,255,0);
  if (!text) ClientMessage("/im <Nick> <Immunity>",player,255,255,0);
  else
  else
  {
  {
local plr = GetPlayer(GetTok( text, " ", 1)
local plr = GetPlayer( GetTok( text, " ", 1 ) );
local im = GetTok( text, " ", 2)
local im = GetTok( text, " ", 2, NumTok( text, " " ) );
  ClientMessage(player.Name+" has set "+plr.Name+"'s immunity to "+im+"!",198,213,0);
plr.Immunity = im.tointeger();
  plr.Immunity = im
  ClientMessageToAll(player.Name+" has set "+plr.Name+"'s immunity to "+im+"!",198,213,0);
  }
  }
  }
}
}
Line 32: Line 33:
=== Notes ===
=== Notes ===
Call [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
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.

Revision as of 10:50, 27 August 2015

This function will ,make a player immune.

Syntax

1

player.Immunity = //Amount here, Max 255.

Arguments

1

  • player <= This will find the player.
  • Immunity <= This is the immunity you need to set.

Example

The following example will set a player's immunity to how much % you 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.