Player.Health

From Liberty Unleashed Wiki
Revision as of 10:32, 11 October 2010 by VRocker (Talk | contribs)

Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function sets/returns the players health.

Syntax

  1. float Player.Health( int Value )

Arguments

  • Value - What you can set the health value to.

Example 1. Returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd== "health" )
  5. {
  6. MessagePlayer( "Your health is " + player.Health + ".", player);
  7. }
  8. }
  9.  

This will tell the player what their health value currently is.

Example 2. Setting

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd== "heal" )
  5. {
  6. player.Health = 100;
  7. }
  8. }
  9.  

This will heal the player whenever they use /heal.

Notes

The call onPlayerCommand and MessagePlayer were used in in this example. More info about them in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox